README
¶
Logs Data Platform - Tail
Installation
To install cli, simply run:
$ go get github.com/ovh/ldp-tail
Usage
ldp-tail --address <URI>
Demo
ldp-tail --address wss://gra1.logs.ovh.com/tail/?tk=demo --pattern "{{ .short_message }}"
Parameters
- Server
addressURI of the websocket
- Filtering
matchDisplay only messages matching the condition. Example:_method=verifyPassword. You may specify an operator like:_method.begin=verifyor negate its meaning like:_method.not.begin=verify. Available operators are:presentThe field is presentbeginThe field begins with the valuecontainThe field contains the valueltThe field is less than the valueleThe field is less than or equal to the valueeqThe field is equal to the valuegeThe field is greater than or equal to the valuegtThe field is greater than the valueregexThe field match the regular expression
- Formatting
rawDisplay raw message instead of parsing itpatternTemplate to apply on each message to display it. Default:{{._appID}}> {{.short_message}}. Custom available functions are:colorSet text color. Available colors are:greenwhiteyellowredbluemagentacyanbColorSet background color. Available colors are:greenwhiteyellowredbluemagentacyannoColorDisable text and background colordateTransform a timestamp in a human readable date. Default format is2006-01-02 15:04:05but can be customized with the second optional argumentjoinConcatenates strings passed in argument with the first argument used as separatorconcatConcatenates strings passed in argumentdurationTransform a value in a human readable duration. First argument must be a parsable number. The second argument is the multiplier coefficient to be applied based on nanoseconds. Ex: 1000000 if the value is in milliseconds.intConverts a string in int64floatConverts a string in float64stringConverts a value to a stringgetReturn the value under the key passed in the second argument of the map passed first argument. Useful for accessing keys containing a period. Ex:{{ get . "foo.bar" }}columnFormats input into multiple columns. Columns are delimited with the characters supplied in the first argument. Ex:"{{ column " | " (date .timestamp) (concat ._method " " ._path ) ._httpStatus_int }}beginReturn true if the first argument begins with the secondcontainReturn true if the second argument is within the firstlevelTransform a Gelf/Syslog level value (0-7) to a syslog severity keyword
- Config
configConfig file loaded before parsing parameters, so parameters will override the values in the config file (except formatchwhere parameters will add more criteria instead of replacing them). The config file use the TOML file format. The structure of the configuration file is:
Address string
Match []{
Key string
Operator string
Value interface{}
Not bool
}
Pattern string
Raw bool
Exemple:
Address = "wss://gra1.logs.ovh.com/tail/?tk=demo"
Pattern = "{{date .timestamp}}: {{if ne ._title \"\"}}[ {{._title}} ] {{end}}{{ .short_message }}"
Contributing
You've developed a new cool feature? Fixed an annoying bug? We'd be happy to hear from you! Make sure to read CONTRIBUTING.md before.
License
This work is under the BSD license, see the LICENSE file for details.
Documentation
¶
There is no documentation for this package.
Click to show internal directories.
Click to hide internal directories.