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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: logAnalyst-1.0.6.tar.gz
  • Upload date:
  • Size: 4.9 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.6.tar.gz
Algorithm Hash digest
SHA256 2feb0f5474fc300882d038b83dcbb1a5f372091a2e7d69ade9d0a16ba2df3364
MD5 c46f31ab32c554466e83219ae7ed9d39
BLAKE2b-256 c75e299fa31fe1fe002b77a2158d594193d26f16930e41e250e7fe0ed466312a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logAnalyst-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 4.8 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b04c1f34d06d14acf26f6ccf2d81dc0e147eeb8839a154f4bd8e342bbca3fca9
MD5 c9606b6f6bb1a992e0cbc02d562df5d8
BLAKE2b-256 a0ad3722a5a9acde86e2bb0f775b8731de97e86bacce77ccacc9b8713dce4f6f

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