{"id":343,"date":"2012-06-19T12:15:36","date_gmt":"2012-06-19T04:15:36","guid":{"rendered":"http:\/\/rmohan.com\/?p=343"},"modified":"2012-06-19T12:15:36","modified_gmt":"2012-06-19T04:15:36","slug":"logging-on-apache","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=343","title":{"rendered":"Logging on Apache"},"content":{"rendered":"<p><strong>Apache server behind a proxy server <\/strong><\/p>\n<p>If you are using an apache server behind a proxy server, you may find that in your log files you will be given the proxy IP as the source IP of the connection. This is true,<br \/>\nhowever you can adjust the apache log settings to pass the X-Forwarded-For IP onto the apache log files.<\/p>\n<p>My original log settings looked like this (httpd.conf)<br \/>\n1\tLogFormat &#8220;%h %l %u %t \\&#8221;%r\\&#8221; %>s %b \\&#8221;%{Referer}i\\&#8221; &#8221; combined<\/p>\n<p>The apache log settings dictate that %h is the source IP, in my instance it was my Proxy server. By changing my apache log format to<br \/>\n1\tLogFormat &#8220;%{X-Forwarded-For}i %l %u %t \\&#8221;%r\\&#8221; %>s %b \\&#8221;%{Referer}i\\&#8221; \\&#8221;%{User-Agent}i\\&#8221; %h&#8221; sitename<\/p>\n<p>and then telling the site config to use the \u2018sitename\u2019 settings<br \/>\nview source<br \/>\nprint?<br \/>\n1\tCustomLog logs\/rmohan-access_log sitename<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Apache server behind a proxy server <\/p>\n<p>If you are using an apache server behind a proxy server, you may find that in your log files you will be given the proxy IP as the source IP of the connection. This is true, however you can adjust the apache log settings to pass the X-Forwarded-For [&#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\/343"}],"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=343"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/343\/revisions"}],"predecessor-version":[{"id":344,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/343\/revisions\/344"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}