Web logs analysis
Webservers logs format
Webservers, such as Apache
or nginx
, usually follow known / standard log formats by default.
The following standard log formats are notably in use:
Name | Template | Example | Remarks |
---|---|---|---|
|
|
| A |
|
|
| Identical to the |
| |||
|
Graphical web logs parsers / viewer
GoAccess
GoAccess
is a C program that can be used to parse webserver logs to get a first level of statistics for the given logs: total requests, unique visitors, operating systems and browsers stats (if user-agent information is available), accessed endpoints, etc. GoAccess
supports many web log formats (Apache, Nginx, Amazon S3, Elastic Load Balancing, CloudFront, etc.) and can outputs reports in JSON
, CSV
or HTML
.
Statistics linked to specifics IPs require to first filter the log files.
HTTP logs viewer
The http Logs Viewer
application, formerly Apache Logs Viewer
, supports various webservers logs (Apache, IIS, nginx, etc.) and allows filtering based on various fields.
Only limited functionalities are however available in the free version and some key features require the paid version (20$ for individuals, 70$ for corporations as of 2022-08).
Automated attack patterns detection
Apache access logs
The Scalp!
Python script can be used in combination with the PHPIDS
project's regular expression filters to automatically detect common attacks (SQL
injection, cross-site scripting (XSS)
, local and remote file inclusion, etc.). The PHPIDS
project's default_filter.xml
defines 78 optimized and tested regex.
Scalp!
parses the specified Apache
logs files and leverages the PHPIDS
project's regular expressions to detect the matching attack patterns.
The analysis of 10 000 lines of logs takes around 90 seconds (on a i7-4700MQ
CPU), and while Scalp!
implements a time frame filter, the functionnality does not seem to be functionnal.
For larger Apache
log files, the files can be splited in multiple parts and the analysis multi-threaded, to the maximun processing power, using the Linux xargs
utility. Doing so, the analysis time of 100 000 lines of logs is reduced to around 200 seconds (on a i7-4700MQ
CPU).
References
https://httpd.apache.org/docs/current/logs.html
Last updated