{"id":6999,"date":"2017-09-12T15:04:55","date_gmt":"2017-09-12T07:04:55","guid":{"rendered":"http:\/\/rmohan.com\/?p=6999"},"modified":"2017-09-12T15:04:55","modified_gmt":"2017-09-12T07:04:55","slug":"using-vlogger-to-split-apache-logs","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6999","title":{"rendered":"USING VLOGGER TO SPLIT APACHE LOGS"},"content":{"rendered":"<p>Vlogger is a program that handles large amounts of virtualhost logs and splits it to separate files.<br \/>\nThis is a short HOWTO to configure it using Apache.<\/p>\n<p>Install vlogger in debian etch<br \/>\n# aptitude install vlogger<br \/>\nMake sure you have working Apache server<\/p>\n<p>Configuring vlogger<br \/>\nChange the LogFormat line (there are multiple LogFormat lines \u2013 in this example we will change the one that is named combined) in \/etc\/apache2\/apache2.conf. We must add the string %v at the beginning of it<\/p>\n<p>vi \/etc\/apache2\/apache2.conf<\/p>\n<p>#LogFormat \u201c%h %l %u %t \\\u201d%r\\\u201d %>s %b \\\u201d%{Referer}i\\\u201d \\\u201d%{User-Agent}i\\\u201d&#8221; combined<br \/>\nLogFormat \u201c%v %h %l %u %t \\\u201d%r\\\u201d %>s %b \\\u201d%{Referer}i\\\u201d \\\u201d%{User-Agent}i\\\u201d&#8221; combined<br \/>\nAdd the following CustomLog line to the same file (you can put it directly after the LogFormat line)<\/p>\n<p>vi \/etc\/apache2\/apache2.conf<\/p>\n<p>CustomLog \u201c| \/usr\/sbin\/vlogger -s access.log \/var\/log\/apache2? combined<br \/>\nNOTE<br \/>\nWe only need one CustomLog directive in our whole Apache configuration. Please disable all other CustomLog directives, especially in your virtual host configurations.<\/p>\n<p>Restart apache<\/p>\n<p># \/etc\/init.d\/apache2 restart<br \/>\nVlogger will now create subdirectories in the \/var\/log\/apache2 directory, one per virtual host, and create access logs that contain the current date in the file name. It will also create a symlink called access.log that points to the current log file.<\/p>\n<p>Let\u2019s assume we have two virtual hosts, www.example1.com and www.example2.com. Then this is how the \/var\/log\/apache2 directory will look like:<\/p>\n<p># ls \/var\/log\/apache2\/<\/p>\n<p>www.example1.com\/<br \/>\n09022008-access.log<br \/>\n09012008-access.log<br \/>\naccess.log -> 09022008-access.log<br \/>\nwww.example2.com\/<br \/>\n09022008-access.log<br \/>\n09012008-access.log<br \/>\naccess.log -> 09022008-access.log<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Vlogger is a program that handles large amounts of virtualhost logs and splits it to separate files. This is a short HOWTO to configure it using Apache.<\/p>\n<p>Install vlogger in debian etch # aptitude install vlogger Make sure you have working Apache server<\/p>\n<p>Configuring vlogger Change the LogFormat line (there are multiple LogFormat lines \u2013 [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6999"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6999"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6999\/revisions"}],"predecessor-version":[{"id":7000,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6999\/revisions\/7000"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6999"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6999"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6999"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}