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.7.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

logAnalyst-1.0.7-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file logAnalyst-1.0.7.tar.gz.

File metadata

  • Download URL: logAnalyst-1.0.7.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.15 CPython/3.10.6 Linux/5.19.3-zen1-1-zen

File hashes

Hashes for logAnalyst-1.0.7.tar.gz
Algorithm Hash digest
SHA256 6ec4b7442b3eff8b53c65f095c6474c9c98bd93fca2640ef1ddde09651c01db7
MD5 a25a71f594b92d22c1e46b7e29b31295
BLAKE2b-256 33ed79a94f4c923e4fbb7914c2e097c2e4bd2313151cd464cb9540808d0edefa

See more details on using hashes here.

File details

Details for the file logAnalyst-1.0.7-py3-none-any.whl.

File metadata

  • Download URL: logAnalyst-1.0.7-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.15 CPython/3.10.6 Linux/5.19.3-zen1-1-zen

File hashes

Hashes for logAnalyst-1.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ca8538068e693b0657a2730645a49abeaa423be97bc66fc9133c2920ea95acbe
MD5 47d66acfe50db6dd9d278720cff6527f
BLAKE2b-256 3fdc2be8a6a61566654cd50839a41de4206301a1c5e6fa939ac38279ec3bf669

See more details on using hashes here.

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