aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Graylog
diff options
context:
space:
mode:
authorAndrewRademacher <andrew.rademacher@smrxt.com>2016-02-27 20:23:26 -0600
committerAndrewRademacher <andrew.rademacher@smrxt.com>2016-02-27 20:23:26 -0600
commit640e69ef77aea530af800741e453b05e2802d188 (patch)
tree6c682bdeccca3af9dafe40d7642a0823625aaa72 /src/Graylog
parentc91dbdc0f5be0f1ec6a0cafc441eef0aa6da58d7 (diff)
downloadhaskell-graylog-640e69ef77aea530af800741e453b05e2802d188.tar.gz
haskell-graylog-640e69ef77aea530af800741e453b05e2802d188.tar.zst
haskell-graylog-640e69ef77aea530af800741e453b05e2802d188.zip
Framed UDP function.
Diffstat (limited to 'src/Graylog')
-rw-r--r--src/Graylog/UDP.hs17
1 files changed, 13 insertions, 4 deletions
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