{"id":128,"date":"2018-11-12T15:52:06","date_gmt":"2018-11-12T15:52:06","guid":{"rendered":"https:\/\/jan.schnasse.org\/blog\/?p=128"},"modified":"2018-11-12T15:52:06","modified_gmt":"2018-11-12T15:52:06","slug":"what-to-do-with-apache-logs","status":"publish","type":"post","link":"https:\/\/jan.schnasse.org\/blog\/2018\/11\/12\/what-to-do-with-apache-logs\/","title":{"rendered":"What to do with apache logs?"},"content":{"rendered":"<div class=\"wiki-content\">\n<p>Two simple things are easily achievable .<\/p>\n<ol>\n<li>Loading logs into a log file analyser <a class=\"external-link\" href=\"https:\/\/matomo.org\/\" rel=\"nofollow\">https:\/\/matomo.org\/<\/a><\/li>\n<li>Depersonalize<\/li>\n<\/ol>\n<p>An example setup on Ubuntu is shown below.<\/p>\n<p>Configure two daily running cronjobs<\/p>\n<pre>0 1 * * * \/scripts\/<a href=\"https:\/\/gist.github.com\/jschnasse\/63169ee2442a0d5eace1ef46100e472e#file-import-logfiles-sh\">import-logfiles.sh<\/a><\/pre>\n<pre>0 2 * * * \/scripts\/<a href=\"https:\/\/gist.github.com\/jschnasse\/63169ee2442a0d5eace1ef46100e472e#file-depersonalize-apache-logs-sh\">depersonalize-apache-logs.sh<\/a><\/pre>\n<p>Use <a href=\"https:\/\/gist.github.com\/jschnasse\/63169ee2442a0d5eace1ef46100e472e#file-import-logfiles-sh\">import-logfiles.sh<\/a> to load all server requests into the matomo database. Use <a href=\"https:\/\/gist.github.com\/jschnasse\/63169ee2442a0d5eace1ef46100e472e#file-depersonalize-apache-logs-sh\">depersonalize-apache-logs.sh\u00a0<\/a>to anonymize all logs older than seven days. Depersonalization is achieved by replacing the last two bytes of IP-adresses with\u00a0 0.<\/p>\n<p>Both scripts work on a default Ubuntu setup of apache2.\u00a0 Apache\u00a0 Logfiles are\u00a0 compressed and end with &#8218;gz&#8216;. They are placed in &#8218;\/var\/log\/apache2&#8216; and start with the prefix &#8218;localhost-access.&#8216;<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Two simple things are easily achievable . Loading logs into a log file analyser https:\/\/matomo.org\/ Depersonalize An example setup on Ubuntu is shown below. Configure two daily running cronjobs 0 1 * * * \/scripts\/import-logfiles.sh 0 2 * * * \/scripts\/depersonalize-apache-logs.sh Use import-logfiles.sh to load all server requests into the matomo database. Use depersonalize-apache-logs.sh\u00a0to anonymize [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,15],"tags":[],"class_list":["post-128","post","type-post","status-publish","format-standard","hentry","category-admin","category-software"],"_links":{"self":[{"href":"https:\/\/jan.schnasse.org\/blog\/wp-json\/wp\/v2\/posts\/128","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jan.schnasse.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jan.schnasse.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jan.schnasse.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jan.schnasse.org\/blog\/wp-json\/wp\/v2\/comments?post=128"}],"version-history":[{"count":0,"href":"https:\/\/jan.schnasse.org\/blog\/wp-json\/wp\/v2\/posts\/128\/revisions"}],"wp:attachment":[{"href":"https:\/\/jan.schnasse.org\/blog\/wp-json\/wp\/v2\/media?parent=128"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jan.schnasse.org\/blog\/wp-json\/wp\/v2\/categories?post=128"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jan.schnasse.org\/blog\/wp-json\/wp\/v2\/tags?post=128"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}