Skip to main content

Show events from log files converting input date formats to a unique format: '%Y-%m-%d %H:%M:%S'.

Project description

grepbydate

Show events from log files converting input date formats to a unique format: '%Y-%m-%d %H:%M:%S'.

  • Format dates in specified input files.
  • Transparently works on *.gz and *.xz files.
  • Transparently transforms audit.log timestamps.
  • Shows full stack trace if starting line matches the filtering options.
  • Optional filtering by a time range.
  • Optional filtering by Regexp. (Optionally ignore case)

Usage

usage: grepbydate [-h] [-f DATE_FROM] [-i] [-t DATE_TO] [-s SEARCH] inputfiles [inputfiles ...]

Show events from log files converting input date formats to a unique format: '%Y-%m-%d %H:%M:%S'.

positional arguments:
  inputfiles            (Required). file/s to read.

options:
  -h, --help            show this help message and exit
  -f, --from DATE_FROM  (Optional). Filter from this datetime.
  -i, --ignorecase      (Optional). Ignore case on the search Regular Expression.
  -t, --to DATE_TO      (Optional). Filter until this datetime.
  -s, --search SEARCH   (Optional). Filter lines using this Regex.

Supported date format for `--from` and `--to` filters: ['%Y-%m-%d', '%Y-%m-%d %H', '%Y-%m-%d %H:%M', '%Y-%m-%d %H:%M:%S', '%Y-%m-%dT%H',
'%Y-%m-%dT%H:%M', '%Y-%m-%dT%H:%M:%S']

Examples

  • Get events from /var/log recursively from a specific date to last available date:
grepbydate -f 2025-06-02 /var/log/
  • Get events from /var/log and /var/lib/pgsl/data/log into a time range:
grepbydate -f "2025-06-02 12:34:07" -t "2025-06-02 12:34:09" /var/log/ /var/lib/pgsql/data/log/
  • Get events from input files matching Katello.*error regular expresion.
grepbydate $(find /var/log/foreman/ -type f) -s "Katello.*error"
  • Get opened and closed sessions from /var/log/secure-2025* ignoring case.
grepbydate /var/log/secure-2025* -s "OPEned|CLosed" -i

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

grepbydate-0.0.2.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grepbydate-0.0.2-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file grepbydate-0.0.2.tar.gz.

File metadata

  • Download URL: grepbydate-0.0.2.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for grepbydate-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5866a20c4fa1ec3800114043abb30714c6eaadab6275341d7a8c8ee966f55a96
MD5 dbb574fd9103ab2fd65caebc6fdc2738
BLAKE2b-256 38ed5892c9fa7c67bd9018e5bb08bfe85d2792e7cbd6059905ba2bafcd6373b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for grepbydate-0.0.2.tar.gz:

Publisher: publish-pypi.yml on pafernanr/grepbydate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grepbydate-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: grepbydate-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for grepbydate-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 24473a31ca24ad8e0cef7aaee5787dcbb21ab757c523850ac7cb385bde133e5a
MD5 235dcf6a96bb849ce8345bc25bd31a09
BLAKE2b-256 dddc29ec1eda4ee53dc61fe6a53d0cd5405c78b8e3b978748e792df5ad602df8

See more details on using hashes here.

Provenance

The following attestation bundles were made for grepbydate-0.0.2-py3-none-any.whl:

Publisher: publish-pypi.yml on pafernanr/grepbydate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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