GithubHelp home page GithubHelp logo

bejibiu / log-analyzer Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 50.74 MB

This project is intended for analyzing the nginx log. Work with `gzip` and `plant` format. Parses the last file by date in the file name

Python 79.89% HTML 20.11%

log-analyzer's Introduction

Log analyzer

This project is intended for analyzing the nginx log. Work with gzip and plant format (.gz or without). Parses the last file by date in the file name

Requirements

  • Nginx log must be match this format:
    $remote_addr $remote_user $http_x_real_ip [$time_local] "$request" 
    $status $body_bytes_sent "$http_referer" 
    "$http_user_agent" "$http_x_forwarded_for" "$http_X_REQUEST_ID" "$http_X_RB_USER"
    $request_time'
    
  • Log file must be named as nginx-access-ui.log-20170601.log where 20100601 - it's date create log
  • To run test install pytest
    pip install -r requiments.txt

How install

  • Download project
git clone https://github.com/bejibiu/Log-analyzer.git

Usage example

  • Run analyze
    python main.py
  • Run test:
    pip install pytest
    python -m pytest

Settings

Project has default settings. You can set new settings in file config.ini or a configuration using a custom path and them run main.py with options --config <path to config.ini>.

A custom config is an ini file. In the file in the main section you can describe the settings

Settings:

Name Description Default value
BASE_DIR root folder with the project .
LOG_DIR Folder where nginx logs are located BASE_DIR/logs/nginx
REPORT_DIR Folder to save the report to BASE_DIR/report_dir
REPORT_SIZE how many URLs with the maximum response time to leave in the report. Calculated by the sum of ' $request_time` 1000
TEMPLATE Folder with the template for the report BASE_DIR/template/report.html
FAILURE_PERC max percent failure parced time_sum to generate report 50
LOG_FILE File log. if set None log will write stdin None

log-analyzer's People

Contributors

bejibiu avatar

Stargazers

sunset 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.