GithubHelp home page GithubHelp logo

logreducer's Introduction

Log Reducer

Log Reducer is a Python tool designed to parse and reduce log files based on keywords or IP addresses. It organizes log entries into separate files, making it easier to analyze and manage log data.

Features

  • Parse log files and extract lines based on specified keywords or IP addresses.
  • Organize log entries into separate files for each keyword or IP address.
  • Generate global log files containing all matched lines for both keywords and IP addresses.
  • Supports recursive processing of log files within a specified folder.

Getting Started

Prerequisites

  • Python 3.x
  • (Optional) Virtual environment for isolating dependencies

Installation

  1. Clone the repository:

    git clone https://github.com/Abdou0xdz/logReducer.git
  2. Navigate to the project folder:

    cd logReducer
  3. (Optional) Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  4. Install dependencies:

    pip install -r requirements.txt

Usage

python log_reducer.py log_folder output_folder -k keyword1 keyword2 -ip 192.168.1.1 10.0.0.1

Replace log_folder with the path to the folder containing your log files and output_folder with the desired output directory.

  • Use the -k option followed by keywords to filter logs based on keywords.
  • Use the -ip option followed by IP addresses to filter logs based on IP addresses.

Example with keyword file and IP file:

python log_reducer.py log_folder output_folder -kf keyword_file.txt -ipf ip_file.txt

Options

  • -k, --keywords: Keyword(s) to filter logs.
  • -kf, --keyword_file: File containing a list of keywords.
  • -ip, --ip_addresses: IP address(es) pattern to filter logs.
  • -ipf, --ip_file: File containing a list of IP addresses.
  • --skip-reserved: Skip reserved and local IP addresses.

Contributing

Contributions are welcome! Please follow the Contribution Guidelines.

License

This project is licensed under the MIT License - see the LICENSE file for details.

logreducer's People

Contributors

h3xano avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.