Skip to main content

Analyse some log files

Project description

Log analyst

Features

  • parse log files
  • filters by date / timestamps
  • correlates log lines (start and end of some processing)
    • show total duration
  • friendly colored output
  • able to output short summaries
  • supports gzipped files

Usage

For instance, with systemd logs:

journalctl -b 5 -o short-iso | loga -s correlators/sample.toml

Sample correlation

Note: the "loganalyst" section is a configuration, which is optional, use only in case overriding values is needed.

Find the sample correlation in correlators/sample.toml:

[loganalyst]
# patterns required before & after the ISO date to consider the log line valid
ts_lines_prefix = ".*"
ts_lines_suffix = ""
# What will be searched for in each line to extract the ISO date
iso_regex = '(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d)|(\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d)'
# timezone used in dates input by the user
timezone = "CEST"

["Basic pattern-less correlation"]
start = "this is the start"
end = "end over"

["Correlation using a pattern"]
start = 'starting request (\d+)'
end = 'request (\d+) ended.'
debug = true # adds some extra verbosity, useful when making new rules

["systemd units start"]
start = 'systemd\[\d+\]: Starting (.*?)[.]+'
end = 'systemd\[\d+\]: Started (.*)\.$'

["systemd units sockets"]
start = 'systemd\[\d+\]: Listening on (.*?)[.]+'
end = 'systemd\[\d+\]: Closed (.*)\.$'

["systemd units duration"]
start = 'systemd\[\d+\]: Started (.*?) ?[.]+$'
end = 'systemd\[\d+\]: Stopped (.*)\.$'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logAnalyst-1.0.6.tar.gz (4.9 kB view hashes)

Uploaded Source

Built Distribution

logAnalyst-1.0.6-py3-none-any.whl (4.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page