Skip to main content

Simple Python library to use parse log files

Project description

Redparser

Redparser is a simple Python program that can parse a log based on command line arguments.

Usage

Run util.py as a Python script, passing the log file as the last argument to utilize the mmap library for fast searches or push the log file to memory for the util to read log file from stdin.

Example:

./util.py --last 10 --timestamps --ipv4 --ipv6 example.log

Outputs: Alt Text

The complete usage can be seen by using the -h flag.

usage: ./util.py [OPTION]... [FILE]
usage: cat [FILE] | ./util.py [OPTION]
usage: redparser [OPTION]... [FILE]
usage: cat [FILE] | redparser[OPTION]

Parse logs of various kinds

optional arguments:
  -h, --help            show this help message and exit
  -f, --first NUM       Print first NUM lines
  -l, --last NUM        Print last NUM lines
  -t, --timestamps      Print lines that contain a timestamp in HH:MM:SS format
  -i, --ipv4 IP         Print lines that contain an IPv4 address, matching IPs (Optional) highlighted
  -I, --ipv6 IP         Print lines that contain an IPv6 address, matching IPs (Optional) highlighted

Install with pip

pip install redparser

TODO

  • Search by timestamp
  • Should be able to check ip address from cmdline matches a line (easy fix)

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

redparser-2.0.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

redparser-2.0.0-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file redparser-2.0.0.tar.gz.

File metadata

  • Download URL: redparser-2.0.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for redparser-2.0.0.tar.gz
Algorithm Hash digest
SHA256 acb96a54b155c7e6dca8660034e01e166c2c72a52f7fd05cc617cc8cea5dab44
MD5 c9c566c0909d49b8a4e16a67f0dd9d7a
BLAKE2b-256 8097f944f06316f3f6103952c77cf9a7b255639a682f702edc39aa8ae1644b3a

See more details on using hashes here.

File details

Details for the file redparser-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: redparser-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.5.0 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for redparser-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c8c4d849d367fb70a15367dead7f60d49c09621d7df57c66da3c70a619573ab3
MD5 9b19e13dcb8b51e27595cdb4d802f8b7
BLAKE2b-256 57673f8a93ca0d850e3e591311ef6c2aa1b98371433e49a1fe012a7d848d076a

See more details on using hashes here.

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