<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://halfface.se/wiki/index.php?action=history&amp;feed=atom&amp;title=Apache</id>
	<title>Apache - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://halfface.se/wiki/index.php?action=history&amp;feed=atom&amp;title=Apache"/>
	<link rel="alternate" type="text/html" href="https://halfface.se/wiki/index.php?title=Apache&amp;action=history"/>
	<updated>2026-04-19T07:27:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.1</generator>
	<entry>
		<id>https://halfface.se/wiki/index.php?title=Apache&amp;diff=13107&amp;oldid=prev</id>
		<title>Ekaanbj: /* POST logging mod_security */</title>
		<link rel="alternate" type="text/html" href="https://halfface.se/wiki/index.php?title=Apache&amp;diff=13107&amp;oldid=prev"/>
		<updated>2019-01-24T13:52:46Z</updated>

		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;POST logging mod_security&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Documentation=&lt;br /&gt;
&lt;br /&gt;
 http://httpd.apache.org/docs/2.3/mod/core.html&lt;br /&gt;
&lt;br /&gt;
=proxy=&lt;br /&gt;
&lt;br /&gt;
The idea is to receive all incoming requests on a single HTTP server. This server, using mod_proxy and mod_rewrite, will route requests to X backend servers, acting as a reverse proxy. This can be done very simply once mod_proxy is installed, by adding lines such as:&lt;br /&gt;
 &lt;br /&gt;
 RewriteEngine on&lt;br /&gt;
 RewriteRule ^t(.*)$ http://somewhere.com/ [P,L]&lt;br /&gt;
&lt;br /&gt;
This would route all requests starting with a t to the site somewhere.com and present its contents to the user as if delivered by the front server.&lt;br /&gt;
=who is hammering my apache?=&lt;br /&gt;
 sudo perl -e &amp;#039;$ip{(split)[0]}++ while &amp;lt;&amp;gt;; print map &amp;quot;$_ : $ip{$_}\n&amp;quot;, sort {$ip{$b} &amp;lt;=&amp;gt; $ip{$a}} keys %ip&amp;#039; /var/log/httpd/halfface.se.access.log&lt;br /&gt;
=POST logging mod_security=&lt;br /&gt;
yum install mod_security&lt;br /&gt;
 /etc/httpd/conf.d/mod_security.conf.bak3 &lt;br /&gt;
 LoadModule security2_module modules/mod_security2.so&lt;br /&gt;
 &amp;lt;IfModule !mod_unique_id.c&amp;gt;&lt;br /&gt;
  LoadModule unique_id_module modules/mod_unique_id.so&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
 &amp;lt;IfModule mod_security2.c&amp;gt;&lt;br /&gt;
  SecRuleEngine On&lt;br /&gt;
  SecAuditEngine on&lt;br /&gt;
  SecAuditLog /var/log/httpd/modsec_audit.log&lt;br /&gt;
  SecRequestBodyAccess on&lt;br /&gt;
  SecResponseBodyAccess on&lt;br /&gt;
  SecUploadKeepFiles On&lt;br /&gt;
  SecUploadDir /var/log/httpd/files&lt;br /&gt;
  SecAuditLogParts ABCEIFGHZ&lt;br /&gt;
  SecDefaultAction &amp;quot;nolog,noauditlog,allow,phase:2&amp;quot;&lt;br /&gt;
  SecRule REQUEST_METHOD &amp;quot;POST&amp;quot; &amp;quot;id:1000,phase:2,ctl:auditEngine=On,nolog,pass&amp;quot;&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=POST logging mod_dumpio=&lt;br /&gt;
/etc/httpd/conf.d/mod_dumpio.conf.bak &lt;br /&gt;
 LoadModule dumpio_module modules/mod_dumpio.so&lt;br /&gt;
 &amp;lt;IfModule dumpio_module&amp;gt;&lt;br /&gt;
  DumpIOInput On&lt;br /&gt;
  DumpIOOutput On&lt;br /&gt;
  # DumpIOLogLevel debug&lt;br /&gt;
  LogLevel debug&lt;br /&gt;
 &amp;lt;/IfModule&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=apachectl=&lt;br /&gt;
Verify apache config file.&lt;br /&gt;
 apachectl -S -f /etc/httpd/conf/httpd.conf&lt;br /&gt;
&lt;br /&gt;
=Is module loaded=&lt;br /&gt;
 apachectl -t -D DUMP_MODULES 2&amp;gt;&amp;amp;1 | grep -i dumpio&lt;br /&gt;
=logging=&lt;br /&gt;
Format examples. Both mean same thing.&lt;br /&gt;
 # CustomLog with format nickname&lt;br /&gt;
 LogFormat &amp;quot;%h %l %u %t \&amp;quot;%r\&amp;quot; %&amp;gt;s %b&amp;quot; common&lt;br /&gt;
 CustomLog &amp;quot;logs/access_log&amp;quot; common&lt;br /&gt;
 &lt;br /&gt;
 # CustomLog with explicit format string&lt;br /&gt;
 CustomLog &amp;quot;logs/access_log&amp;quot; &amp;quot;%h %l %u %t \&amp;quot;%r\&amp;quot; %&amp;gt;s %b&amp;quot;&lt;br /&gt;
One line explained.&lt;br /&gt;
 LogFormat &amp;quot;%{X-Forwarded-For}i %h %u %t \&amp;quot;%r\&amp;quot; %&amp;gt;s %b %D %P %X \&amp;quot;%{Referer}i\&amp;quot; \&amp;quot;%{User-Agent}i\&amp;quot;&amp;quot; combined&lt;br /&gt;
 CustomLog logs/api-access_log combined&lt;br /&gt;
Example&lt;br /&gt;
 146.192.224.227, 10.199.85.25 10.199.85.25 -       [22/Sep/2018:00:47:23 +0000] &amp;quot;GET /blabla. HTTP/1.1&amp;quot; 200          6008          343783            13792   -                 &amp;quot;-&amp;quot;       &amp;quot;curl/7.38.0&amp;quot;&lt;br /&gt;
 X-Forwarded for, Remote hostname           user    Time                         &amp;quot;First line of request&amp;quot; final_status size_response time_serve_millis Process Connection_status &amp;quot;Referer&amp;quot; &amp;quot;user_agent&amp;quot;&lt;br /&gt;
Variables described.&lt;br /&gt;
 %{X-Forwared-For}i=The contents of X-Forwared-For: header line&lt;br /&gt;
 %h=Remote hostname.&lt;br /&gt;
 %u=Remote user&lt;br /&gt;
 %t=Time the request was received&lt;br /&gt;
 %r=First line of request&lt;br /&gt;
 %&amp;gt;s=final status.&lt;br /&gt;
 %b=Size of response in bytes&lt;br /&gt;
 %D=The time taken to serve the request, in microseconds.&lt;br /&gt;
 %P=The process ID of the child that serviced the request.&lt;br /&gt;
 %X	Connection status when response is completed:&lt;br /&gt;
   X=Connection aborted before the response completed.&lt;br /&gt;
   +=Connection may be kept alive after the response is sent.&lt;br /&gt;
   -=Connection will be closed after the response is sent.&lt;br /&gt;
 %{Referer}i=The contents of User-Agent: header line&lt;br /&gt;
 %{User-Agent}i=The contents of User-Agent: header line&lt;br /&gt;
 &lt;br /&gt;
[[Category:Applications]]&lt;br /&gt;
[[Category:Unix]]&lt;br /&gt;
[[Category:Web]]&lt;/div&gt;</summary>
		<author><name>Ekaanbj</name></author>
	</entry>
</feed>