Skip to content

MSO4SC/remotelogger-cli

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remote Logger CLI

Command line interface to follow incremental log files, filter lines and send to the remote-logger server.

Note
under development

Basic usage

usage: Send your logs to remote endpoints [-h] -f FILTER [-c CONFIG]
                                          [-sh HOST] [-u USER] [-p PASSWD]
                                          [-e EXCHANGE] [-rk ROUTING_KEY]
                                          [-q QUEUE] [-sp PORT]
                                          [-et EXCHANGE_TYPE] [-hb HEARTBEAT]
                                          [-bct BLOCKED_CONNECTION_TIMEOUT]

Example

$ # Using a configuration file:
$ remotelogger-cli.py --filter test/filter.yaml --config test/config.yaml
$ # Using command line arguments:
$ remotelogger-cli.py --filter test/filter.yaml -sh localhost -u guest -p guest -e exchange -rk routing_key -q queue

Config file

The Config file is an alternative way to provide connection configuration parameters instead of passing them as command line arguments.

Config file example

Configuration file is in YAML format

{
    "host": "localhost",
    "port": 5672,
    "user": "guest",
    "pass": "guest",
    "exchange": "exchange",
    "exchange_type": "direct",
    "routing_key": "routing_key",
    "queue": "queue",
    "heartbeat": 0,
    "blocked_connection_timeout": 300
}

Filter file

Filter file points to the log files to follow and defines filters to categorize log lines.

Filters are based on regular expressions and uses re library to match patterns.

Once a log line is filtered, some properties can be defined per filter:

  • severity: Severity level of the message (NONE, INFO, WARNING, ERROR, SUCCESS)

  • verbosity: Verbosity level (None or 0-5)

Regular expressions

To filter a particular line of your log file you have to define the regular expression pattern.

Patterns sintax are based on re library

The filter feature is based on re.match function.

Filter file example

Configuration file is in YAML format.

[
    {
        "filename": log.txt,
        "filters": [
            {pattern: "^INFO", severity: "INFO"},
            {pattern: "^WARN", severity: "WARNING"}
        ]
    },
    {
        "filename": log2.txt,
        "filters": [
            {pattern: "^ERROR", severity: "ERROR"},
            {pattern: "^OK", severity: "OK" }
        ]
    }
]

About

Tail logs and send them to a server (MSO4SC)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 99.7%
  • Dockerfile 0.3%