<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: WTD: Apache module/plugin to log requests when they arrive</title>
	<atom:link href="http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/feed/" rel="self" type="application/rss+xml" />
	<link>http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/</link>
	<description>News and announcements regarding FreshPorts, The Place For Ports.</description>
	<pubDate>Fri, 29 Aug 2008 06:34:03 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Fredrik</title>
		<link>http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1385</link>
		<dc:creator>Fredrik</dc:creator>
		<pubDate>Fri, 29 Sep 2006 15:48:54 +0000</pubDate>
		<guid isPermaLink="false">http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1385</guid>
		<description>The famous ports-deleted.php :)</description>
		<content:encoded><![CDATA[<p>The famous ports-deleted.php :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Langille</title>
		<link>http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1384</link>
		<dc:creator>Dan Langille</dc:creator>
		<pubDate>Fri, 29 Sep 2006 13:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1384</guid>
		<description>Does anyone see a pattern?  ;)

$ tail -F /var/log/messages &#124; grep "kernel: pid"
Sep 29 05:57:06 havoc kernel: pid 12570 (httpd), uid 80: exited on signal 6
^C
$ grep 12570 /var/log/messages
Sep 29 05:54:04 havoc FRESHPORTS PID[12570]: /commits.php
Sep 29 05:54:27 havoc FRESHPORTS PID[12570]: /search.php?query=trac&#038;search=go&#038;num=10&#038;stype=name&#038;method=match&#038;deleted=excludedeleted&#038;start=11&#038;casesensitivity=caseinsensitive
Sep 29 05:55:46 havoc FRESHPORTS PID[12570]: /news.php
Sep 29 05:55:51 havoc FRESHPORTS PID[12570]: /news.php
Sep 29 05:56:11 havoc FRESHPORTS PID[12570]: /games/crack-attack/
Sep 29 05:56:20 havoc FRESHPORTS PID[12570]: /ports-deleted.php
Sep 29 05:57:06 havoc kernel: pid 12570 (httpd), uid 80: exited on signal 6
$ tail -F /var/log/messages &#124; grep "kernel: pid"


$ tail -F /var/log/messages &#124; grep "kernel: pid"
Sep 29 05:57:45 havoc kernel: pid 12564 (httpd), uid 80: exited on signal 6

$ grep 12564 /var/log/messages
Sep 29 05:53:57 havoc FRESHPORTS PID[12564]: /science/minc
Sep 29 05:54:06 havoc FRESHPORTS PID[12564]: /www/mod_dav/
Sep 29 05:54:09 havoc FRESHPORTS PID[12564]: /news.php
Sep 29 05:54:36 havoc FRESHPORTS PID[12564]: /rss/
Sep 29 05:54:40 havoc FRESHPORTS PID[12564]: /news.php
Sep 29 05:54:59 havoc FRESHPORTS PID[12564]: /search.php?query=tracker&#038;search=go&#038;num=10&#038;stype=name&#038;method=match&#038;deleted=excludedeleted&#038;start=1&#038;casesensitivity=caseinsensitive
Sep 29 05:55:59 havoc FRESHPORTS PID[12564]: /rss/ports-new.php
Sep 29 05:56:06 havoc FRESHPORTS PID[12564]: /
Sep 29 05:56:10 havoc FRESHPORTS PID[12564]: /news.php
Sep 29 05:56:37 havoc FRESHPORTS PID[12564]: /news.php
Sep 29 05:56:44 havoc FRESHPORTS PID[12564]: /news.php
Sep 29 05:56:56 havoc FRESHPORTS PID[12564]: /ports-deleted.php
Sep 29 05:57:45 havoc kernel: pid 12564 (httpd), uid 80: exited on signal 6





$ tail -F /var/log/messages &#124; grep "kernel: pid"
Sep 29 05:58:27 havoc kernel: pid 13440 (httpd), uid 80: exited on signal 6


$ tail -F /var/log/messages &#124; grep "kernel: pid"
Sep 29 05:58:27 havoc kernel: pid 13440 (httpd), uid 80: exited on signal 6
^C
$ grep 13440 /var/log/messages
Sep 29 05:57:43 havoc FRESHPORTS PID[13440]: /security/altivore/files.php?message_id=200405231542.i4NFg832094829@repoman.freebsd.org
Sep 29 05:57:43 havoc FRESHPORTS PID[13440]: /ports-deleted.php
Sep 29 05:58:27 havoc kernel: pid 13440 (httpd), uid 80: exited on signal 6




$ tail -F /var/log/messages &#124; grep "kernel: pid"

Sep 29 05:59:07 havoc kernel: pid 12919 (httpd), uid 80: exited on signal 6



$ grep 12919 /var/log/messages
Sep 29 05:53:55 havoc FRESHPORTS PID[12919]: /
Sep 29 05:54:14 havoc FRESHPORTS PID[12919]: /net-im/centericq/
Sep 29 05:54:31 havoc FRESHPORTS PID[12919]: /news.php
Sep 29 05:54:34 havoc FRESHPORTS PID[12919]: /
Sep 29 05:55:30 havoc FRESHPORTS PID[12919]: /categories.php
Sep 29 05:55:41 havoc FRESHPORTS PID[12919]: /
Sep 29 05:56:16 havoc FRESHPORTS PID[12919]: /www/sarg
Sep 29 05:56:42 havoc FRESHPORTS PID[12919]: /news.php
Sep 29 05:57:03 havoc FRESHPORTS PID[12919]: /sysutils/cpuburn/
Sep 29 05:58:29 havoc FRESHPORTS PID[12919]: /ports-deleted.php
Sep 29 05:59:07 havoc kernel: pid 12919 (httpd), uid 80: exited on signal 6</description>
		<content:encoded><![CDATA[<p>Does anyone see a pattern?  ;)</p>
<p>$ tail -F /var/log/messages | grep &#8220;kernel: pid&#8221;<br />
Sep 29 05:57:06 havoc kernel: pid 12570 (httpd), uid 80: exited on signal 6<br />
^C<br />
$ grep 12570 /var/log/messages<br />
Sep 29 05:54:04 havoc FRESHPORTS PID[12570]: /commits.php<br />
Sep 29 05:54:27 havoc FRESHPORTS PID[12570]: /search.php?query=trac&#038;search=go&#038;num=10&#038;stype=name&#038;method=match&#038;deleted=excludedeleted&#038;start=11&#038;casesensitivity=caseinsensitive<br />
Sep 29 05:55:46 havoc FRESHPORTS PID[12570]: /news.php<br />
Sep 29 05:55:51 havoc FRESHPORTS PID[12570]: /news.php<br />
Sep 29 05:56:11 havoc FRESHPORTS PID[12570]: /games/crack-attack/<br />
Sep 29 05:56:20 havoc FRESHPORTS PID[12570]: /ports-deleted.php<br />
Sep 29 05:57:06 havoc kernel: pid 12570 (httpd), uid 80: exited on signal 6<br />
$ tail -F /var/log/messages | grep &#8220;kernel: pid&#8221;</p>
<p>$ tail -F /var/log/messages | grep &#8220;kernel: pid&#8221;<br />
Sep 29 05:57:45 havoc kernel: pid 12564 (httpd), uid 80: exited on signal 6</p>
<p>$ grep 12564 /var/log/messages<br />
Sep 29 05:53:57 havoc FRESHPORTS PID[12564]: /science/minc<br />
Sep 29 05:54:06 havoc FRESHPORTS PID[12564]: /www/mod_dav/<br />
Sep 29 05:54:09 havoc FRESHPORTS PID[12564]: /news.php<br />
Sep 29 05:54:36 havoc FRESHPORTS PID[12564]: /rss/<br />
Sep 29 05:54:40 havoc FRESHPORTS PID[12564]: /news.php<br />
Sep 29 05:54:59 havoc FRESHPORTS PID[12564]: /search.php?query=tracker&#038;search=go&#038;num=10&#038;stype=name&#038;method=match&#038;deleted=excludedeleted&#038;start=1&#038;casesensitivity=caseinsensitive<br />
Sep 29 05:55:59 havoc FRESHPORTS PID[12564]: /rss/ports-new.php<br />
Sep 29 05:56:06 havoc FRESHPORTS PID[12564]: /<br />
Sep 29 05:56:10 havoc FRESHPORTS PID[12564]: /news.php<br />
Sep 29 05:56:37 havoc FRESHPORTS PID[12564]: /news.php<br />
Sep 29 05:56:44 havoc FRESHPORTS PID[12564]: /news.php<br />
Sep 29 05:56:56 havoc FRESHPORTS PID[12564]: /ports-deleted.php<br />
Sep 29 05:57:45 havoc kernel: pid 12564 (httpd), uid 80: exited on signal 6</p>
<p>$ tail -F /var/log/messages | grep &#8220;kernel: pid&#8221;<br />
Sep 29 05:58:27 havoc kernel: pid 13440 (httpd), uid 80: exited on signal 6</p>
<p>$ tail -F /var/log/messages | grep &#8220;kernel: pid&#8221;<br />
Sep 29 05:58:27 havoc kernel: pid 13440 (httpd), uid 80: exited on signal 6<br />
^C<br />
$ grep 13440 /var/log/messages<br />
Sep 29 05:57:43 havoc FRESHPORTS PID[13440]: /security/altivore/files.php?message_id=200405231542.i4NFg832094829@repoman.freebsd.org<br />
Sep 29 05:57:43 havoc FRESHPORTS PID[13440]: /ports-deleted.php<br />
Sep 29 05:58:27 havoc kernel: pid 13440 (httpd), uid 80: exited on signal 6</p>
<p>$ tail -F /var/log/messages | grep &#8220;kernel: pid&#8221;</p>
<p>Sep 29 05:59:07 havoc kernel: pid 12919 (httpd), uid 80: exited on signal 6</p>
<p>$ grep 12919 /var/log/messages<br />
Sep 29 05:53:55 havoc FRESHPORTS PID[12919]: /<br />
Sep 29 05:54:14 havoc FRESHPORTS PID[12919]: /net-im/centericq/<br />
Sep 29 05:54:31 havoc FRESHPORTS PID[12919]: /news.php<br />
Sep 29 05:54:34 havoc FRESHPORTS PID[12919]: /<br />
Sep 29 05:55:30 havoc FRESHPORTS PID[12919]: /categories.php<br />
Sep 29 05:55:41 havoc FRESHPORTS PID[12919]: /<br />
Sep 29 05:56:16 havoc FRESHPORTS PID[12919]: /www/sarg<br />
Sep 29 05:56:42 havoc FRESHPORTS PID[12919]: /news.php<br />
Sep 29 05:57:03 havoc FRESHPORTS PID[12919]: /sysutils/cpuburn/<br />
Sep 29 05:58:29 havoc FRESHPORTS PID[12919]: /ports-deleted.php<br />
Sep 29 05:59:07 havoc kernel: pid 12919 (httpd), uid 80: exited on signal 6</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Langille</title>
		<link>http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1383</link>
		<dc:creator>Dan Langille</dc:creator>
		<pubDate>Fri, 29 Sep 2006 12:36:06 +0000</pubDate>
		<guid isPermaLink="false">http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1383</guid>
		<description>DOH!

As I went to code this, I remembered why it won't work.  I was logging the database queries with the PID.  The PID being logged was not that of the httpd process.  I'm assuming it was that of the PostgreSQL process.  Then I thought: well, I should try it anyway.  And it works... Here is the code I'm using:

openlog('FRESHPORTS PID', LOG_PID &#124; LOG_NDELAY, LOG_SYSLOG);
syslog(LOG_NOTICE, $_SERVER["REQUEST_URI"]);
closelog();

In /var/log/messages, I'm seeing:

Sep 29 08:29:29 polo FRESHPORTS PID[97197]: /
Sep 29 08:33:44 polo FRESHPORTS PID[23632]: /

$ ps auwx &#124; grep 23632
www     23632  0.0  1.7 14076 8632  ??  S     8:29AM   0:00.03 /usr/local/sbin/httpd -DSSL

I'll run this a bit longer in beta before moving it to proproduction.  Thanks.</description>
		<content:encoded><![CDATA[<p>DOH!</p>
<p>As I went to code this, I remembered why it won&#8217;t work.  I was logging the database queries with the PID.  The PID being logged was not that of the httpd process.  I&#8217;m assuming it was that of the PostgreSQL process.  Then I thought: well, I should try it anyway.  And it works&#8230; Here is the code I&#8217;m using:</p>
<p>openlog(&#8217;FRESHPORTS PID&#8217;, LOG_PID | LOG_NDELAY, LOG_SYSLOG);<br />
syslog(LOG_NOTICE, $_SERVER[&#8221;REQUEST_URI&#8221;]);<br />
closelog();</p>
<p>In /var/log/messages, I&#8217;m seeing:</p>
<p>Sep 29 08:29:29 polo FRESHPORTS PID[97197]: /<br />
Sep 29 08:33:44 polo FRESHPORTS PID[23632]: /</p>
<p>$ ps auwx | grep 23632<br />
www     23632  0.0  1.7 14076 8632  ??  S     8:29AM   0:00.03 /usr/local/sbin/httpd -DSSL</p>
<p>I&#8217;ll run this a bit longer in beta before moving it to proproduction.  Thanks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dan Langille</title>
		<link>http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1382</link>
		<dc:creator>Dan Langille</dc:creator>
		<pubDate>Fri, 29 Sep 2006 11:17:10 +0000</pubDate>
		<guid isPermaLink="false">http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1382</guid>
		<description>Apache is writing the core files.

The one-liner in the PHP scripts is a very good idea. I'll try that.

Thank you.</description>
		<content:encoded><![CDATA[<p>Apache is writing the core files.</p>
<p>The one-liner in the PHP scripts is a very good idea. I&#8217;ll try that.</p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pav Lucistnik</title>
		<link>http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1381</link>
		<dc:creator>Pav Lucistnik</dc:creator>
		<pubDate>Fri, 29 Sep 2006 09:34:41 +0000</pubDate>
		<guid isPermaLink="false">http://news.freshports.org/2006/09/28/wtd-apache-moduleplugin-to-log-requests-when-they-arrive/#comment-1381</guid>
		<description>Can't you do a post-mortem analysis of a core file? That will lead you directly to the problem. Or, if you fail to persuade Apache to start writing core files, just attach gdb to a running child, and wait for a crash. I used both of these strategies before.

Or, you can prepend a one liner to all your php scripts, that will log just what you want... I believe your Apache is crashing in mod_php or elsewhere, not in a core httpd code...</description>
		<content:encoded><![CDATA[<p>Can&#8217;t you do a post-mortem analysis of a core file? That will lead you directly to the problem. Or, if you fail to persuade Apache to start writing core files, just attach gdb to a running child, and wait for a crash. I used both of these strategies before.</p>
<p>Or, you can prepend a one liner to all your php scripts, that will log just what you want&#8230; I believe your Apache is crashing in mod_php or elsewhere, not in a core httpd code&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
