Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base64Decode ¶
type Base64Decode struct {
// contains filtered or unexported fields
}
Base64Decode is a formatter that decodes a base64 message. If a message is not or only partly base64 encoded an error will be logged and the decoded part is returned. RFC 4648 is expected. Configuration example
- "<producer|stream>": Formatter: "format.Base64Decode" Base64Formatter: "format.Forward" Base64Dictionary: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890+/"
Base64Dictionary defines the 64-character base64 lookup dictionary to use. When left empty a dictionary as defined by RFC4648 is used. This is the default.
Base64DataFormatter defines a formatter that is applied before the base64 decoding takes place. By default this is set to "format.Forward"
func (*Base64Decode) Configure ¶
func (format *Base64Decode) Configure(conf core.PluginConfig) error
Configure initializes this formatter with values from a plugin config.
func (*Base64Decode) Format ¶
func (format *Base64Decode) Format(msg core.Message) ([]byte, core.MessageStreamID)
Format returns the original message payload
type Base64Encode ¶
type Base64Encode struct {
// contains filtered or unexported fields
}
Base64Encode is a formatter that encodes a message as base64. Configuration example
- "<producer|stream>": Formatter: "format.Base64Encode" Base64Formatter: "format.Forward" Base64Dictionary: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz01234567890+/"
Base64Dictionary defines the 64-character base64 lookup dictionary to use. When left empty a dictionary as defined by RFC4648 is used. This is the default.
Base64DataFormatter defines a formatter that is applied before the base64 encoding takes place. By default this is set to "format.Forward"
func (*Base64Encode) Configure ¶
func (format *Base64Encode) Configure(conf core.PluginConfig) error
Configure initializes this formatter with values from a plugin config.
func (*Base64Encode) Format ¶
func (format *Base64Encode) Format(msg core.Message) ([]byte, core.MessageStreamID)
Format returns the original message payload
type CollectdToInflux08 ¶ added in v0.4.0
type CollectdToInflux08 struct {
// contains filtered or unexported fields
}
CollectdToInflux08 provides a transformation from collectd JSON data to InfluxDB 0.8.x compatible JSON data. Trailing and leading commas are removed from the Collectd message beforehand. Configuration example
- "<producer|stream>": Formatter: "format.CollectdToInflux08" CollectdToInfluxFormatter: "format.Forward"
CollectdToInfluxFormatter defines the formatter applied before the conversion from Collectd to InfluxDB. By default this is set to format.Forward.
func (*CollectdToInflux08) Configure ¶ added in v0.4.0
func (format *CollectdToInflux08) Configure(conf core.PluginConfig) error
Configure initializes this formatter with values from a plugin config.
func (*CollectdToInflux08) Format ¶ added in v0.4.0
func (format *CollectdToInflux08) Format(msg core.Message) ([]byte, core.MessageStreamID)
Format transforms collectd data to influx 0.8.x data
type CollectdToInflux09 ¶ added in v0.4.0
type CollectdToInflux09 struct {
// contains filtered or unexported fields
}
CollectdToInflux09 provides a transformation from collectd JSON data to InfluxDB 0.9.x compatible JSON data. Trailing and leading commas are removed from the Collectd message beforehand. Configuration example
- "<producer|stream>": Formatter: "format.CollectdToInflux09" CollectdToInfluxFormatter: "format.Forward"
CollectdToInfluxFormatter defines the formatter applied before the conversion from Collectd to InfluxDB. By default this is set to format.Forward.
func (*CollectdToInflux09) Configure ¶ added in v0.4.0
func (format *CollectdToInflux09) Configure(conf core.PluginConfig) error
Configure initializes this formatter with values from a plugin config.
func (*CollectdToInflux09) Format ¶ added in v0.4.0
func (format *CollectdToInflux09) Format(msg core.Message) ([]byte, core.MessageStreamID)
Format transforms collectd data to influx 0.9.x data
type Envelope ¶
type Envelope struct {
// contains filtered or unexported fields
}
Envelope is a formatter that allows prefixing and/or postfixing a message with configurable strings. Configuration example
- "<producer|stream>": Formatter: "format.Envelope" EnvelopeFormatter: "format.Forward" EnvelopePrefix: "<data>" EnvelopePostfix: "</data>\n"
Prefix defines the message prefix. By default this is set to "". Special characters like \n \r \t will be transformed into the actual control characters.
Postfix defines the message postfix. By default this is set to "\n". Special characters like \n \r \t will be transformed into the actual control characters.
EnvelopeDataFormatter defines the formatter for the data transferred as message. By default this is set to "format.Forward"
type Forward ¶
type Forward struct { }
Forward is a formatter that passes a message as is Configuration example
- "<producer|stream>": Formatter: "format.Forward"
type Hostname ¶
type Hostname struct {
// contains filtered or unexported fields
}
Hostname is a formatter that prefixes a message with the hostname. Configuration example
- "<producer|stream>": Formatter: "format.Hostname" HostnameFormatter: "format.Envelope" HostnameSeparator: " "
HostnameDataFormatter defines the formatter for the data transferred as message. By default this is set to "format.Envelope"
HostnameSeparator sets the separator character placed after the hostname. This is set to " " by default.
type Identifier ¶
type Identifier struct {
// contains filtered or unexported fields
}
Identifier is a formatter that will generate a (mostly) unique 64 bit identifier number from the message timestamp and sequence number. The message payload will not be encoded.
- "<producer|stream>": Formatter: "format.Identifier" IdentifierType: "hash"
IdentifierType defines the algorithm used to generate the message id. This my be one of the following: "hash", "time", "seq", "seqhex". By default this is set to "time".
- When using "hash" the message payload will be hashed using fnv1a and returned
as hex.
- When using "time" the id will be formatted YYMMDDHHmmSSxxxxxxx where x
denotes the sequence number modulo 10.000.000. I.e. 10mil messages per second are possible before there is a collision.
- When using "seq" the id will be returned as the integer representation of
the sequence number.
- When using "seqhex" the id will be returned as the hex representation of
the sequence number.
IdentifierDataFormatter defines the formatter for the data that is used to build the identifier from. By default this is set to "format.Forward"
func (*Identifier) Configure ¶
func (format *Identifier) Configure(conf core.PluginConfig) error
Configure initializes this formatter with values from a plugin config.
func (*Identifier) Format ¶
func (format *Identifier) Format(msg core.Message) ([]byte, core.MessageStreamID)
Format generates a unique identifier from the message contents or metadata.
type JSON ¶
type JSON struct {
// contains filtered or unexported fields
}
JSON is a formatter that passes a message encapsulated as JSON in the form {"message":"..."}. The actual message is formatted by a nested formatter and HTML escaped. Configuration example
- "<producer|stream>": Formatter: "format.JSON" JSONStartState: "findKey" JSONDirectives:
- 'findKey :": key ::'
- 'findKey :}: : pop : end'
- 'key :": findVal : : key'
- 'findVal :\:: value ::'
JSONStartState defines the initial parser state when parsing a message. By default this is set to "" which will fall back to the first state used in the JSONDirectives array.
JSONTimestampRead defines the go timestamp format expected from fields that are parsed as "dat". By default this is set to "20060102150405"
JSONTimestampWrite defines the go timestamp format that "dat" fields will be converted to. By default this is set to "2006-01-02 15:04:05 MST"
JSONDirectives defines an array of parser directives. This setting is mandatory and has no default value. Each string must be of the following format:
State:Token:NextState:Flag,Flag,...:Function
Spaces will be stripped from all fields but Token. If a fields requires a colon it has to be escaped with a backslash. Other escape characters supported are \n, \r and \t. Flag can be a set of the following flags
- continue -> Prepend the token to the next match
- append -> Append the token to the current match and continue reading
- include -> Append the token to the current match
- push -> Push the current state to the stack
- pop -> Pop the stack and use the returned state if possible
The following names are allowed in the Function field:
- key -> Write the current match as a key
- val -> Write the current match as a value without quotes
- esc -> Write the current match as a escaped string value
- dat -> Write the current match as a timestamp value
- arr -> Start a new array
- obj -> Start a new object
- end -> Close an array or object
- arr+val -> arr followed by val
- arr+esc -> arr followed by esc
- arr+dat -> arr followed by dat
- val+end -> val followed by end
- esc+end -> esc followed by end
- dat+end -> dat followed by end
If num or str is written without a previous key write, a key will be auto generated from the current parser state name. This does not happen when inside an array. If key is written without a previous value write, a null value will be written. This does not happen after an object has been started. A key write inside an array will cause the array to be closed. If the array is nested, all arrays will be closed.
type Runlength ¶
type Runlength struct {
// contains filtered or unexported fields
}
Runlength is a formatter that prepends the length of the message, followed by a ":". The actual message is formatted by a nested formatter. Configuration example
- "<producer|stream>": Formatter: "format.Runlength" RunlengthFormatter: "format.Envelope"
RunlengthDataFormatter defines the formatter for the data transferred as message. By default this is set to "format.Forward"
type Sequence ¶
type Sequence struct {
// contains filtered or unexported fields
}
Sequence is a formatter that allows prefixing a message with the message's sequence number Configuration example
- "<producer|stream>": Formatter: "format.Sequence" SequenceFormatter: "format.Envelope"
SequenceDataFormatter defines the formatter for the data transferred as message. By default this is set to "format.Forward"
type Serialize ¶ added in v0.4.0
type Serialize struct {
// contains filtered or unexported fields
}
Serialize is a formatter that serializes a message for later retrieval. Configuration example
- "<producer|stream>": Formatter: "format.Serialize" SerializeFormatter: "format.Envelope" SerializeStringEncode: true
SerializeFormatter defines the formatter for the data transferred as message. By default this is set to "format.Forward"
SerializeStringEncode causes the serialized data to be base64 encoded and newline separated. This is enabled by default.
type StreamName ¶ added in v0.4.0
type StreamName struct {
// contains filtered or unexported fields
}
StreamName is a formatter that prefixes a message with the StreamName. Configuration example
- "<producer|stream>": Formatter: "format.StreamName" StreamNameFormatter: "format.Envelope"
StreamNameFormatter defines the formatter for the data transferred as message. By default this is set to "format.Envelope"
StreamNameHistory can be set to true to not use the current but the previous stream name. This can be usefull to e.g. get the name of the stream messages were dropped from. By default this is set to false.
StreamNameSeparator sets the separator character placed after the stream name. This is set to " " by default.
func (*StreamName) Configure ¶ added in v0.4.0
func (format *StreamName) Configure(conf core.PluginConfig) error
Configure initializes this formatter with values from a plugin config.
func (*StreamName) Format ¶ added in v0.4.0
func (format *StreamName) Format(msg core.Message) ([]byte, core.MessageStreamID)
Format prepends the StreamName of the message to the message.
type StreamRevert ¶ added in v0.4.0
type StreamRevert struct {
// contains filtered or unexported fields
}
StreamRevert is a formatter that recovers the last used stream from a message and sets it as a new target stream. Streams change whenever the Stream.Route or Message.Route function is used. This e.g. happens after a Drop call. Configuration example
- "<producer|stream>": Formatter: "format.StreamRevert" StreamRevertFormatter: "format.Forward"
StreamRevertFormatter defines the formatter applied after reading the stream. This formatter is applied to the data after StreamRevertDelimiter. By default this is set to "format.Forward"
func (*StreamRevert) Configure ¶ added in v0.4.0
func (format *StreamRevert) Configure(conf core.PluginConfig) error
Configure initializes this formatter with values from a plugin config.
func (*StreamRevert) Format ¶ added in v0.4.0
func (format *StreamRevert) Format(msg core.Message) ([]byte, core.MessageStreamID)
Format adds prefix and postfix to the message formatted by the base formatter
type StreamRoute ¶ added in v0.4.0
type StreamRoute struct {
// contains filtered or unexported fields
}
StreamRoute is a formatter that modifies a message's stream by reading a prefix from the message's data (and discarding it). The prefix is defined by everything before a given delimiter in the message. If no delimiter is found or the prefix is empty the message stream is not changed. Configuration example
- "<producer|stream>": Formatter: "format.StreamRoute" StreamRouteFormatter: "format.Forward" StreamRouteDelimiter: "$"
StreamRouteFormatter defines the formatter applied after reading the stream. This formatter is applied to the data after StreamRouteDelimiter. By default this is set to "format.Forward"
StreamRouteDelimiter defines the delimiter to search when extracting the stream name. By default this is set to ":".
func (*StreamRoute) Configure ¶ added in v0.4.0
func (format *StreamRoute) Configure(conf core.PluginConfig) error
Configure initializes this formatter with values from a plugin config.
func (*StreamRoute) Format ¶ added in v0.4.0
func (format *StreamRoute) Format(msg core.Message) ([]byte, core.MessageStreamID)
Format adds prefix and postfix to the message formatted by the base formatter
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
Timestamp is a formatter that allows prefixing a message with a timestamp (time of arrival at gollum) as well as postfixing it with a delimiter string. Configuration example
- "<producer|stream>": Formatter: "format.Timestamp" TimestampFormatter: "format.Envelope" Timestamp: "2006-01-02T15:04:05.000 MST | "
Timestamp defines a Go time format string that is used to format the actual timestamp that prefixes the message. By default this is set to "2006-01-02 15:04:05 MST | "
TimestampDataFormatter defines the formatter for the data transferred as message. By default this is set to "format.Forward"