diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Graylog/Gelf.hs | 2 | ||||
-rw-r--r-- | src/Graylog/Types.hs | 8 | ||||
-rw-r--r-- | src/Graylog/UDP.hs | 1 |
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 | ||
5 | module Graylog.Gelf where | 7 | module Graylog.Gelf where |
6 | 8 | ||
7 | import Data.Aeson (ToJSON (..), Value (..), genericToJSON, | 9 | import 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 | |||
22 | import Network.BSD | 22 | import Network.BSD |
23 | import Network.Socket | 23 | import Network.Socket |
24 | 24 | ||
25 | -- | The maximum size of each datagram when using UDP transit methods. | ||
25 | type ChunkSize = Word | 26 | type 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. | ||
27 | data Graylog | 30 | data Graylog |
28 | = Graylog | 31 | = Graylog |
29 | { _graylogHost :: String | 32 | { _graylogHost :: String |
@@ -38,7 +41,10 @@ defaultChunkSize :: ChunkSize | |||
38 | defaultChunkSize = 8192 | 41 | defaultChunkSize = 8192 |
39 | 42 | ||
40 | openGraylog | 43 | openGraylog |
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) | ||
42 | openGraylog h p cksize | 48 | openGraylog 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. | ||
1 | module Graylog.UDP | 2 | module Graylog.UDP |
2 | ( sendLog | 3 | ( sendLog |
3 | 4 | ||