Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This is a log scribe that writes logs to logz.io's bulk <https://app.logz.io/#/dashboard/data-sources/Bulk-HTTPS HTTPS API>.
Synopsis
- mkLogzIOScribe :: LogzIOScribeConfiguration -> PermitFunc -> Verbosity -> IO Scribe
- data BulkAPIError = BulkAPIError {}
- data LogzIOScribeConfiguration = LogzIOScribeConfiguration {
- logzIOScribeConfiguration_bufferItems :: Int
- logzIOScribeConfiguration_bufferTimeout :: NominalDiffTime
- logzIOScribeConfiguration_scheme :: Scheme
- logzIOScribeConfiguration_host :: Host
- logzIOScribeConfiguration_port :: Port
- logzIOScribeConfiguration_token :: APIToken
- logzIOScribeConfiguration_retry :: RetryPolicyM IO
- logzIOScribeConfiguration_onError :: LoggingError -> IO ()
- data Scheme
- newtype APIToken = APIToken {}
- data LoggingError
- usRegionHost :: Host
- euRegionHost :: Host
- httpsPort :: Port
- httpPort :: Port
- defaultRetryPolicy :: Monad m => RetryPolicyM m
- defaultLogzIOScribeConfiguration :: APIToken -> LogzIOScribeConfiguration
- renderLineTruncated :: LogItem a => Verbosity -> Item a -> (Builder, Bytes)
- renderLineTruncated' :: LogItem a => Bytes -> Verbosity -> Item a -> (Builder, Bytes)
- maxPayloadBytes :: Bytes
- maxLogLineLength :: Bytes
- data BulkBuffer = BulkBuffer {}
- data LogAction buf
- bufferItem :: LogItem a => Int -> Verbosity -> Item a -> BulkBuffer -> LogAction BulkBuffer
- bufferItem' :: LogItem a => Bytes -> Bytes -> Int -> Verbosity -> Item a -> BulkBuffer -> LogAction BulkBuffer
- forceFlush :: Monoid buf => buf -> LogAction buf
- newtype Bytes = Bytes {}
Scribe construction
mkLogzIOScribe :: LogzIOScribeConfiguration -> PermitFunc -> Verbosity -> IO Scribe Source #
Types
data BulkAPIError Source #
This is returned when the bulk import was a partial success
BulkAPIError | |
|
Instances
FromJSON BulkAPIError Source # | |
Defined in Katip.Scribes.LogzIO.HTTPS parseJSON :: Value -> Parser BulkAPIError # parseJSONList :: Value -> Parser [BulkAPIError] # | |
Show BulkAPIError Source # | |
Defined in Katip.Scribes.LogzIO.HTTPS showsPrec :: Int -> BulkAPIError -> ShowS # show :: BulkAPIError -> String # showList :: [BulkAPIError] -> ShowS # | |
Eq BulkAPIError Source # | |
Defined in Katip.Scribes.LogzIO.HTTPS (==) :: BulkAPIError -> BulkAPIError -> Bool # (/=) :: BulkAPIError -> BulkAPIError -> Bool # |
data LogzIOScribeConfiguration Source #
LogzIOScribeConfiguration | |
|
This particular bulk API only supports HTTP or HTTPS. HTTPS is strongly recommended for security reasons.
You can retrieve your account or sub-account's API token on the <https://app.logz.io/#/dashboard/settings/manage-accounts manage accounts page>. Note that APIToken has an IsString instance, meaning that you can use a string literal with OverloadedStrings enabled.
data LoggingError Source #
URIError HttpException | The URI generated was invalid. Check your configuration |
RequestError HttpException | We encountered an exception while sending the batch request |
PartialFailure BulkAPIError | Some or all of the request was rejected. Check the logz.io UI for indexing errors. |
BadToken | Your API token was rejected. |
UnknownFailureResponse Status ByteString | An error returned, but it could not be decoded into a
|
Instances
Show LoggingError Source # | |
Defined in Katip.Scribes.LogzIO.HTTPS showsPrec :: Int -> LoggingError -> ShowS # show :: LoggingError -> String # showList :: [LoggingError] -> ShowS # |
Presets for configuration
usRegionHost :: Host Source #
See <https://support.logz.io/hc/en-us/articles/210206365-What-IP-addresses-should-I-open-in-my-firewall-to-ship-logs-to-Logz-io- this> for a list of listeners. This is the US region host, listener.logz.io
euRegionHost :: Host Source #
See <https://support.logz.io/hc/en-us/articles/210206365-What-IP-addresses-should-I-open-in-my-firewall-to-ship-logs-to-Logz-io- this> for a list of listeners. This is the EU region host, listener.logz.io
defaultRetryPolicy :: Monad m => RetryPolicyM m Source #
A reasonable retry policy: exponential backoff with 25ms base delay up to 5 retries, for a total cumulative delay of 775ms.
defaultLogzIOScribeConfiguration :: APIToken -> LogzIOScribeConfiguration Source #
A default configuration:
- 100 item buffering
- 30 second buffer timeout
- US, HTTPS logging endpoint (listener.logz.io:8071)
defaultRetryPolicy
of 25ms exponential backoff, 5 retries- Ignore logging errors
Internal API exported for testing
renderLineTruncated :: LogItem a => Verbosity -> Item a -> (Builder, Bytes) Source #
A version of renderLine
which renders a line and stays under
the maximum line size of 500,000 bytes. If the default rendering is
too large, the log will be reduced to a timestamp and a potentially
truncated message.
:: LogItem a | |
=> Bytes | Custom max log line length. Be careful, too low and no amount of shrinking can get under the size, breaking the invariant. For the production limit, we are guraanteed always able to come in under the limit. |
-> Verbosity | |
-> Item a | |
-> (Builder, Bytes) |
A generalized renderLineTruncated that takes a custom line length limit. This is exclusively for testing.
maxPayloadBytes :: Bytes Source #
How big of a body can we send? The limit is defined here.
maxLogLineLength :: Bytes Source #
How long can each serialized payload be (let's assume including the trailing newline). The limit is defined here.
data BulkBuffer Source #
Instances
Monoid BulkBuffer Source # | |
Defined in Katip.Scribes.LogzIO.HTTPS mempty :: BulkBuffer # mappend :: BulkBuffer -> BulkBuffer -> BulkBuffer # mconcat :: [BulkBuffer] -> BulkBuffer # | |
Semigroup BulkBuffer Source # | |
Defined in Katip.Scribes.LogzIO.HTTPS (<>) :: BulkBuffer -> BulkBuffer -> BulkBuffer # sconcat :: NonEmpty BulkBuffer -> BulkBuffer # stimes :: Integral b => b -> BulkBuffer -> BulkBuffer # |
:: LogItem a | |
=> Int | Maximum items before flushing |
-> Verbosity | |
-> Item a | |
-> BulkBuffer | |
-> LogAction BulkBuffer |
:: LogItem a | |
=> Bytes | Max payload size |
-> Bytes | Max item size |
-> Int | Maximum items before flushing |
-> Verbosity | |
-> Item a | |
-> BulkBuffer | |
-> LogAction BulkBuffer |
An internal version with a configurable max item size and max message size for testing. Be careful with this: if you set the values too low, some of the guarantees about reducability of messages break down.
forceFlush :: Monoid buf => buf -> LogAction buf Source #
When time has run out on a flush, splits the buffer. n.b. this
will always return FlushNow
with an empty new buffer.