scoopex / apache_logpipe

A apache logpipe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

apache_logpipe

About this project

This tool can be used to gather statistics on your apache webserver and send them to the zabbix monitoring system. Apache provides the possibility to use a subprocess which reads from stdin as logging destination. This tool collects the loglines and writes the to a logfile asynchronously comparable to the cronolog utility. It also asynchronously calculates delivery statistics for virtual hosts and send zabbix discoveries and data to zabbix for that hosts. This was my first go training project ;-)

Features

  • Rotate logfile similar to cronolog and logrotate2
  • Analyze accesslogs
    • calculate performance statistics
    • group performance statistics by regular expressions
    • handle static content separately
  • send statistics to zabbix

Installation an usage

  • Compile and build project
    make release
    scp apache_logpipe <webserver>:/usr/local/bin
    
  • Add this directive to your /etc/apache2.conf or apache vhost config
    LogFormat "%h %v:%p %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" %D" 
    CustomLog "|/usr/local/bin --zabbix_server zabbix.mydomain.org --output_logfile '/var/log/apache2/access.log.%Y-%m-%d" vhost_combined_canonical
    
  • Restart Apache
    /etc/init.d/apache2 reload
    
  • Add zabbix template to zabbix and assign it to the host

TODOs and Ideas:

  • write zipped logfiles (https://gist.github.com/mchirico/6147687)
  • Add a simple webserver which provides configuring intefaces/statistics
  • Understand go dependency management
  • Make the code more modular/structured
  • Write documentation

DONE:

About

A apache logpipe

License:GNU General Public License v2.0


Languages

Language:Go 98.4%Language:Makefile 1.6%