Skip to content

Access log analyzer for CLF formatted access logs.

License

Notifications You must be signed in to change notification settings

bernd-clemenz/aloga

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Access log analysis

The module takes access logs as written by Tomcat and finds IPs and does some geo-location checks. The analyzer sits on top of common log file format grammar for ANTLR4, which was modified to allow IPv6 addresses. Geo-data are fetched via ipstack. A access key is required.

Requirements

  • Python 3 installed
  • Internet connection
  • (optional) Java 8 Runtime installed and available via PATH environment variable if rebuilding or modification of the grammar is required.

Build Lexer/Parser

In case the grammar should be extended to cater for more cases:

In the etc/grammar directory do the following:

 java -jar ../tools/antlr-4.7.1-complete.jar -Dlanguage=Python3 clf.g4

Move the generated files to aloga/clf directory. Don't modify the files, even they are not PEP8 compliant.

Configuration

The module is configured by a traditional ini-file.

Name Description
log.file Name of the logging file
log.level Logging output level. Supported values are: DEBUG, INFO, WARN, ERROR, FATAL
timeout Timeout for HTTP requests
ipstack.key Access key for ipstack API

Installation

Anaconda users:

Antlr4 runtime seems not to be part of Anaconda repositories

From source

git clone [email protected]:bernd-clemenz/aloga.git

Switch to the installation directory and run:

python setup.py install

Setup takes care of resolving the dependencies.

Execution

The module is executable like this:

python -m aloga --conf=aloga.ini --alogafile=access_log --out=access_data --nogeo=False

CLI parameter

Name Description
conf Name of the configuration file, defaults to aloga.ini
alogfile Access log file name to interpret
out Base file name, without extension, of output file(s)
nogeo deactivates reading fetching of geo-data, defaults to True

Result

  • a JSON file with parsed access data, where remote hosts are keys
    • some basic statistical evaluations per host. Frequency of HTTP-Status-Types, GEO location data.
  • simple bar-chart image access histogram as PNG
  • a CSV file with all access data

Resources

Copyrights

For the grammar file clf.g4:

BSD License Copyright (c) 2016, Tom Everett All rights reserved.

Antlr 4 License

About

Access log analyzer for CLF formatted access logs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published