Skip to main content

Extract unique Errors blocks from logs files by given "start time" timestamp

Project description

LogTool is used to extract all Unique Errors messages from log files that took place in the past.

General

As the user, you can provide the "since time" and debug level to be used for extraction of Errors/Warnings. For example, if something went wrong in the past, you're be able to extract Error/Warnings messages for just that time period. Let's say that you have all relevant log files located in: /var/log/containers and that the problem you are trying to debug, happened after: 2020-08-25 12:00:00
If so, you'll need to set the following values in ".ini" configuration file and to provide:

time_grep=2020-08-25 12:00:00
log_root_dir=['var/log/containers']
string_for_grep = ERROR

Installation

pip3 install zahlabut

Configuration file

Prior to starting analyze process, you'll need to create and load the configuration file. Configuration file could be any *.ini file and you can find the example/template on GitHub:
https://github.com/zahlabut/LogToolPyPi/blob/master/conf.ini
Note: change the configuration according to your needs.

Usage - Python code example

#!/usr/bin/python3    
from zahlabut.LogTool import *               # To import all from zahlabut LogTool package
load_conf_file('conf.ini')                   # To load the cofiguration file (conf.ini).
result=start_analyzing()                     # Start analyzing log files.
print(result['Standard_Log_Results'][0])     # First item in result list (raw data) for Standard logs.
print(result['Not_Standard_Log_Results'][0]) # First item in result list (raw data) for Not Standard logs. 

Generated result files

LogTool result files will be generated according to the settings provided in "conf.ini" file.

create_logtool_result_file=yes
log_tool_result_file = ResultFile.log
save_standard_logs_raw_data_file='Standard_Logs_Output.log'
save_not_standard_logs_raw_data_file='Not_Standard_Logs_Output.log'

Once "log_tool_result_file = ResultFile.log" is generated you'll be able to find all the statistics + exported unique Error blocks in this file. Created file is generated with some simple logic (its content is divided into the sections) see the description on the top of created result file.

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

zahlabut-0.0.2.18.tar.gz (14.9 kB view details)

Uploaded Source

File details

Details for the file zahlabut-0.0.2.18.tar.gz.

File metadata

  • Download URL: zahlabut-0.0.2.18.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.8

File hashes

Hashes for zahlabut-0.0.2.18.tar.gz
Algorithm Hash digest
SHA256 3fb6343f76f0e9aa94f63aaac04104b6881150529bdc6e3e693e1d77003ce707
MD5 5ae137e3ee2cebf6e1aad13db8416bf8
BLAKE2b-256 22b8f47e4ccfaa5b5ba01cd0f38b7d444fd3605f177df5ea62bf773da918b008

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