aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--graylog.cabal2
-rw-r--r--src/Graylog/UDP.hs17
2 files changed, 14 insertions, 5 deletions
diff --git a/graylog.cabal b/graylog.cabal
index 3eaa812..cc6b2d8 100644
--- a/graylog.cabal
+++ b/graylog.cabal
@@ -28,8 +28,8 @@ library
28 , aeson 28 , aeson
29 , aeson-casing 29 , aeson-casing
30 , bytestring 30 , bytestring
31 , mwc-random
32 , network 31 , network
32 , random
33 , scientific 33 , scientific
34 , text 34 , text
35 , time 35 , time
diff --git a/src/Graylog/UDP.hs b/src/Graylog/UDP.hs
index dc172b9..656cbc8 100644
--- a/src/Graylog/UDP.hs
+++ b/src/Graylog/UDP.hs
@@ -6,8 +6,9 @@ module Graylog.UDP
6 6
7import Data.Aeson 7import Data.Aeson
8import qualified Data.ByteString.Lazy as LBS 8import qualified Data.ByteString.Lazy as LBS
9import Data.Word
9import Network.Socket.ByteString.Lazy 10import Network.Socket.ByteString.Lazy
10import System.Random.MWC 11import System.Random
11 12
12import Graylog.Gelf as Export 13import Graylog.Gelf as Export
13import Graylog.Types as Export 14import Graylog.Types as Export
@@ -16,7 +17,15 @@ sendLog :: Graylog -> GELF -> IO ()
16sendLog glog msg = mapM_ (send $ _graylogSocket glog) cks 17sendLog glog msg = mapM_ (send $ _graylogSocket glog) cks
17 where 18 where
18 raw = encode msg 19 raw = encode msg
19 cks = chunky raw 20 cks = chunky glog raw
20 21
21chunky :: LBS.ByteString -> [LBS.ByteString] 22chunky :: Graylog -> LBS.ByteString -> IO [LBS.ByteString]
22chunky = undefined 23chunky glog raw = do
24 groupId <- randomIO
25 splitAt gsize
26 where
27 magic = undefined
28 seq = undefined
29 total = undefined
30 hlen = 12
31 gsize = (fromIntegral (_graylogChunkSize glog)) - hlen