Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

ApacheLogParser

Simple Apache log parser that will return a Json string containing counters from a log file input.

What counters to expect ?

  • METHOD_HTTPCODE: All HTTP method seen in the log associated with they HTTP CODE will be count.
$ "GET_200":17255,"GET_301":145,"GET_304":58,"GET_404":348,"GET_500":29,"HEAD_200":116,"POST_200":29,
  • EXT_EXTENSION: Number of time a specific extension has been found in the log file
$ "EXT_css":2494,"EXT_gif":377,"EXT_ico":87,"EXT_jpg":2725,"EXT_js":4814,"EXT_pdf":29,"EXT_png":6032,"EXT_woff":87,"EXT_xhtml":1
  • TotalBytes: Size of response in bytes, excluding HTTP headers generated by all requests in the log
"TotalBytes":1947134994}

The full json string will look like this :

./main -log=/var/log/apache2/access_log
`{"EXT_css":2494,"EXT_gif":377,"EXT_ico":87,"EXT_jpg":2725,"EXT_js":4814,"EXT_pdf":29,"EXT_png":6032,"EXT_woff":87,"EXT_xhtml":1,"EXT_xml":29,"GET_200":17255,"GET_301":145,"GET_304":58,"GET_404":348,"GET_500":29,"HEAD_200":116,"POST_200":29,"TotalBytes":1947134994}`

Getting started

This application only take one argument -log=PATH_TO_LOG

To use this parser, your apache log configuration shoud match this format : LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{%Y%m%d%H%M%S}t\"" combined

Configuration

No configuration file yet. You can adjust the extensions you want to catch directly in the file

Contributing

If you want to contribute to this project (thanks !), please fork this repo and commit following commit style by AngularJS.

Todo

  • Detect log format
  • Better regexp

Thanks and happy coding !

About

Simple Apache log parser

Topics

Resources

Stars

0 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages