Skip to main content

A package for analyzing system log files

Project description

lxlog

lxlog is a Python package for analyzing logs in Linux systems. It provides a command-line interface for filtering log data for a specified process or mail logs within a specified date range. The filtered log data is then formatted into a pretty table using the pandas and prettytable libraries. Installation

You can install lxlog using pip:

pip install lxlog Usage

To use lxlog, you can import the main function and call it with the required parameters:

python

from lxlog import main start_date = input("Enter start date (YYYY-MM-DD): ") end_date = input("Enter end date (YYYY-MM-DD): ") log_type = input("Enter log_type: ") result = main(start_date, end_date, log_type) print(result)

The main function accepts three parameters:

start_date: The start date of the log data to analyze in the format YYYY-MM-DD.
end_date: The end date of the log data to analyze in the format YYYY-MM-DD.
log_type: The type of log data to analyze, either syslog or maillog.

If log_type is syslog, the function will prompt for the name of the process to filter for. The function returns a string containing the formatted log data. Some examples:

To get Input form user

python code

from lxlog import main start_date = input("Enter start date (YYYY-MM-DD): ") end_date = input("Enter end date (YYYY-MM-DD): ") log_type = input("Enter log_type: ") result = main(start_date, end_date, log_type) print(result)

In log_type use either syslog or maillog as input.

Filter syslog data for the sshd process between January 1st and January 7th, 2022:

python code

from lxlog import main result = main("2022-01-01", "2022-01-07", "syslog", process_name="sshd") print(result)

Filter maillog data between January 1st and January 7th, 2022: python code

from lxlog import main result = main("2022-01-01", "2022-01-07", "maillog") print(result)

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

lxlog-0.10.0.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

lxlog-0.10.0-py3-none-any.whl (3.7 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