LogReader is a Python tool designed to parse, filter, and output log files based on specific tags, messages, and other parameters. It can handle both individual log files and directories containing multiple logs. This tool is designed to be compatible with the FileLogger library.
Clone the repository to your local machine:
git clone https://github.com/aabolfazl/Tars.git
cd LogReader
Ensure you have Python installed on your system. LogReader is compatible with Python 3.
To use LogReader, run the Log_reader.py
script with Python, providing the necessary arguments.
python logreader.py -i <input_path> [other options]
-i
,--input
: The input file or directory path. (Required)-t
,--tags
: A list of tags for filtering log entries.-m
,--messages
: A list of messages for filtering log entries.-o
,--output
: The output file path. If not provided, the output will be named with the current timestamp.-e
,--exception
: Flag to show exceptions.
Example 1: Parse a single log file and filter by tags.
python Log_reader.py -i /path/to/logfile.log -t ERROR WARNING
Example 2: Parse all logs in a directory and filter by specific messages, outputting to a specified file.
python Log_reader.py -i /path/to/logs/ -m "OutOfMemoryError" "NullPointerException" -o /path/to/output.txt
Example 3: Handle a single log file and show exceptions in the output.
python Log_reader.py -i /path/to/logfile.log -e True
This project is licensed under the MIT License - see the LICENSE file for details.