<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: Which Apache virtual host is getting slammed?</title>
	<link>http://ask.metafilter.com/101193/Which-Apache-virtual-host-is-getting-slammed/</link>
	<description>Comments on Ask MetaFilter post Which Apache virtual host is getting slammed?</description>
	<pubDate>Mon, 08 Sep 2008 12:01:30 -0800</pubDate>
	<lastBuildDate>Mon, 08 Sep 2008 12:01:30 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: Which Apache virtual host is getting slammed?</title>
		<link>http://ask.metafilter.com/101193/Which-Apache-virtual-host-is-getting-slammed</link>	
		<description>Apache 2 + N number of Virtual Hosts = where is the traffic coming from? (in real time!) &lt;br /&gt;&lt;br /&gt; Have an Apache 2 cluster with about 70 virtual hosts, under heavier than normal traffic. Would like some real-time monitoring to figure out what host is being requested the most, without waiting for log information. Any ideas?</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2008:site.101193</guid>
		<pubDate>Mon, 08 Sep 2008 11:33:12 -0800</pubDate>
		<dc:creator>xmutex</dc:creator>
		
			<category>apache</category>
		
			<category>httpd</category>
		
	</item> <item>
		<title>By: cschneid</title>
		<link>http://ask.metafilter.com/101193/Which-Apache-virtual-host-is-getting-slammed#1469659</link>	
		<description>What&apos;s wrong with the logs?  Apache should be writing them out in real time.  When you say logs, do you really mean a log analyzer that is setup to run every night?&lt;br&gt;
&lt;br&gt;
If that&apos;s the case, setup the analyzer to run every 10 minutes, or on demand, or whatever.  That way you can get up-to-date analyzed logs when you want.&lt;br&gt;
&lt;br&gt;
Otherwise, you can always do it manually and parse the logs using perl.  Grab the last 5000 entries from the log file, and count the number of times each domain comes up.  That works out to less than a page or two of code, and you can get the details in nearly real time.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.101193-1469659</guid>
		<pubDate>Mon, 08 Sep 2008 12:01:30 -0800</pubDate>
		<dc:creator>cschneid</dc:creator>
	</item><item>
		<title>By: tomierna</title>
		<link>http://ask.metafilter.com/101193/Which-Apache-virtual-host-is-getting-slammed#1469686</link>	
		<description>Set up server-status:&lt;br&gt;
&lt;br&gt;
&lt;code&gt;&lt;br&gt;
&amp;lt;Location /admin/server-status&amp;gt;&lt;br&gt;
    SetHandler server-status&lt;br&gt;
    Order deny,allow&lt;br&gt;
&amp;lt;/Location&amp;gt;&lt;br&gt;
&lt;br&gt;
ExtendedStatus On&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
This should give you a decent amount of info about which virtual domain is getting what requests and for how much data.&lt;br&gt;
&lt;br&gt;
Be sure to put an .htaccess password on the admin directory so people can&apos;t look at your privates :)</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.101193-1469686</guid>
		<pubDate>Mon, 08 Sep 2008 12:21:07 -0800</pubDate>
		<dc:creator>tomierna</dc:creator>
	</item><item>
		<title>By: moift</title>
		<link>http://ask.metafilter.com/101193/Which-Apache-virtual-host-is-getting-slammed#1469828</link>	
		<description>If each vhosts has its own log you should be able to tell by their size roughly which hosts are getting the traffic, something like:&lt;br&gt;
&lt;pre&gt;ls -la /var/log/httpd/*access?log&lt;/pre&gt;Although the path and the mask to match access logs vs error/other logs may vary.&lt;br&gt;
&lt;br&gt;
If the access log is combined you can try grepping for the various vhosts in the combined file and getting counts. On my host it works out like this, but you&apos;ll doubtless have to change some parameters:&lt;br&gt;
&lt;pre&gt;for vhost in `grep ServerName /etc/apache2/sites-available/default | awk &apos;{ print $2 }&apos;`;do&lt;br&gt;    echo $vhost: `grep $vhost /var/log/apache2/access.log | wc -l`;&lt;br&gt;done&lt;/pre&gt;The backtick-quoted part in the for loop just needs to result in a list of vhosts. In my case it&apos;s straightforward to just grep for the ServerName directory in Apache&apos;s config and print its argument. You could also just write them out in a file and replace that part with `cat thatfile`. /var/log/apache2/access.log should be the actual combined log.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.101193-1469828</guid>
		<pubDate>Mon, 08 Sep 2008 14:03:35 -0800</pubDate>
		<dc:creator>moift</dc:creator>
	</item>
	</channel>
</rss>
