aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Graylog/Gelf.hs2
-rw-r--r--src/Graylog/Types.hs8
-rw-r--r--src/Graylog/UDP.hs1
3 files changed, 10 insertions, 1 deletions
diff --git a/src/Graylog/Gelf.hs b/src/Graylog/Gelf.hs
index cd68e05..ee17e3d 100644
--- a/src/Graylog/Gelf.hs
+++ b/src/Graylog/Gelf.hs
@@ -2,6 +2,8 @@
2{-# LANGUAGE DeriveGeneric #-} 2{-# LANGUAGE DeriveGeneric #-}
3{-# LANGUAGE OverloadedStrings #-} 3{-# LANGUAGE OverloadedStrings #-}
4 4
5-- | Default formatting for Graylog messages,
6-- see http://docs.graylog.org/en/latest/pages/gelf.html
5module Graylog.Gelf where 7module Graylog.Gelf where
6 8
7import Data.Aeson (ToJSON (..), Value (..), genericToJSON, 9import Data.Aeson (ToJSON (..), Value (..), genericToJSON,
diff --git a/src/Graylog/Types.hs b/src/Graylog/Types.hs
index 5c32a8b..5ec779b 100644
--- a/src/Graylog/Types.hs
+++ b/src/Graylog/Types.hs
@@ -22,8 +22,11 @@ import qualified Data.Text as T
22import Network.BSD 22import Network.BSD
23import Network.Socket 23import Network.Socket
24 24
25-- | The maximum size of each datagram when using UDP transit methods.
25type ChunkSize = Word 26type ChunkSize = Word
26 27
28-- | Handle for a socket connected to Graylog. In some cases this socket
29-- is UDP and will not have a maintained session.
27data Graylog 30data Graylog
28 = Graylog 31 = Graylog
29 { _graylogHost :: String 32 { _graylogHost :: String
@@ -38,7 +41,10 @@ defaultChunkSize :: ChunkSize
38defaultChunkSize = 8192 41defaultChunkSize = 8192
39 42
40openGraylog 43openGraylog
41 :: HostName -> ServiceName -> ChunkSize -> IO (Either String Graylog) 44 :: HostName -- ^ The host on which graylog is running.
45 -> ServiceName -- ^ The port on which graylog is running.
46 -> ChunkSize -- ^ The maximum size of each UDP datagram.
47 -> IO (Either String Graylog)
42openGraylog h p cksize 48openGraylog h p cksize
43 | cksize < 1024 = return $ Left "ChunkSize must be at least 1024." 49 | cksize < 1024 = return $ Left "ChunkSize must be at least 1024."
44 | otherwise = getAddrInfo Nothing (Just h) (Just p) >>= \case 50 | otherwise = getAddrInfo Nothing (Just h) (Just p) >>= \case
diff --git a/src/Graylog/UDP.hs b/src/Graylog/UDP.hs
index cd7fe5a..7c8eb84 100644
--- a/src/Graylog/UDP.hs
+++ b/src/Graylog/UDP.hs
@@ -1,3 +1,4 @@
1-- | UDP Chunked support for sending messages to graylog.
1module Graylog.UDP 2module Graylog.UDP
2 ( sendLog 3 ( sendLog
3 4