katip-logzio-0.1.2.0: Logz.IO scribe for the Katip logging framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

Katip.Scribes.LogzIO.HTTPS

Description

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

Scribe construction

Types

data BulkAPIError Source #

This is returned when the bulk import was a partial success

Constructors

BulkAPIError 

Fields

  • bulkAPIError_malformedLines :: Int

    The number of log lines which are not well-formed JSON. This indicates a library bug. Please file an issue on GitHub.

  • bulkAPIError_successfulLines :: Int

    The number of log lines received successfully.

  • bulkAPIError_oversizedLines :: Int

    The number of log lines which exceed the line length limit. katip-logzio makes a best effort to truncate logs that exceed the size limit. This probably indicates a library bug and should be reported as an issue on GitHub.

  • bulkAPIError_emptyLogLines :: Int

    The number of log lines which were empty. There isnt' really a concept of a truly empty log line in katip, so this most likely indicates a library bug and should be reported as an issue on GitHub.

data LogzIOScribeConfiguration Source #

Constructors

LogzIOScribeConfiguration 

Fields

data Scheme Source #

This particular bulk API only supports HTTP or HTTPS. HTTPS is strongly recommended for security reasons.

Constructors

HTTPS

HTTPs should always be used except for local testing.

HTTP 

Instances

Instances details
Show Scheme Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Eq Scheme Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Methods

(==) :: Scheme -> Scheme -> Bool #

(/=) :: Scheme -> Scheme -> Bool #

newtype APIToken Source #

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.

Constructors

APIToken 

Fields

Instances

Instances details
IsString APIToken Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Show APIToken Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Eq APIToken Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

data LoggingError Source #

Constructors

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 BulkAPIError. This may indicate a library bug, which should be reported to the issue tracker.

Instances

Instances details
Show LoggingError Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Presets for configuration

httpsPort :: Port Source #

Logz.io uses port 8071 for HTTPS

httpPort :: Port Source #

Logz.io uses port 8070 for HTTP

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.

renderLineTruncated' Source #

Arguments

:: 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 LogAction buf Source #

Constructors

Buffered buf

New buffer

FlushNow 

Fields

  • buf

    Buffer to flush

  • buf

    New buffer

bufferItem Source #

Arguments

:: LogItem a 
=> Int

Maximum items before flushing

-> Verbosity 
-> Item a 
-> BulkBuffer 
-> LogAction BulkBuffer 

bufferItem' Source #

Arguments

:: 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.

newtype Bytes Source #

Constructors

Bytes 

Fields

Instances

Instances details
Bounded Bytes Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Num Bytes Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Show Bytes Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Methods

showsPrec :: Int -> Bytes -> ShowS #

show :: Bytes -> String #

showList :: [Bytes] -> ShowS #

Eq Bytes Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Methods

(==) :: Bytes -> Bytes -> Bool #

(/=) :: Bytes -> Bytes -> Bool #

Ord Bytes Source # 
Instance details

Defined in Katip.Scribes.LogzIO.HTTPS

Methods

compare :: Bytes -> Bytes -> Ordering #

(<) :: Bytes -> Bytes -> Bool #

(<=) :: Bytes -> Bytes -> Bool #

(>) :: Bytes -> Bytes -> Bool #

(>=) :: Bytes -> Bytes -> Bool #

max :: Bytes -> Bytes -> Bytes #

min :: Bytes -> Bytes -> Bytes #