<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title>Parallels knowledgebase (KB)</title>
<link>http://kb.parallels.com/</link>
<description>Parallels knowledgebase (KB)</description>
<language>en</language>
<copyright>Copyright 2008 Parallels</copyright>
<pubDate>Wed, 10 Sep 2008 00:00:00 +0600</pubDate>
<lastBuildDate>Wed, 10 Sep 2008 00:00:00 +0600</lastBuildDate>
<webMaster>rt-team@parallels.com</webMaster>

<item>
<title><![CDATA[How to recalculate AWstats statistics from logs from previous months? ]]></title>
<link>http://kb.parallels.com/en/5550</link>
<description><![CDATA[<div id="article">
	




	<div id="kb" class="kb">
		<div class="article-container">
			<h2 class="title">How to recalculate AWstats statistics from logs from previous months? </h2>
			<div class="ab-frame"><div class="bl"><div class="br"><div class="tl"><div class="tr"><!-- frame -->
				<div class="articleProperty">
					<div>Article ID: 5550&nbsp;</div>
					<div>Last Review: Jun,23 2009</div>
					<tr>
						<td>Author: </td>
						<td>Bezborodova Anastasiya</td>
					</tr>
					<br/>
					<tr>
						<td>Last updated by: </td>
						<td>Bezborodova Anastasiya</td>
					</tr>
					<strong>APPLIES TO:</strong>
					<div class="articleApplies">
						<ul>
							<li>Plesk 8.x for Linux/Unix</li>
						</ul>
					</div>
				</div><!-- articleProperty -->
			</div></div></div></div></div><!-- frame -->

			<div class="article-internal-flag"></div>

			<div id="article-content">
				<div class="article-part">
					<h2>Resolution</h2>
					Plesk's 'statistics' utility does not use info from previous months' log records and builds AWstats pages for the current month only. To build AWstats pages for previous months follow these steps: <br /> <br />&nbsp;&nbsp;&nbsp; 0) define these environment variables according to requirements: set needed domain name<br /><br /><div class="commandline"><code>export vhost_name=SET.REAL.DOMAIN.NAME.HERE</code></div><br /><br />and set the following ones pretty much the same: <br /><br /><div class="commandline"><code>export AWSTATS_BIN_D=`grep ^AWSTATS_BIN_D /etc/psa/psa.conf | awk '{print $2}'` <br />export HTTPD_VHOSTS_D=`grep ^HTTPD_VHOSTS_D /etc/psa/psa.conf | awk '{print $2}'` <br />export PRODUCT_ROOT_D=`grep ^PRODUCT_ROOT_D /etc/psa/psa.conf | awk '{print $2}'` <br />export awstats=${AWSTATS_BIN_D}/awstats.pl <br />export awstats_gen_opts=&quot;-staticlinks -configdir=${PRODUCT_ROOT_D}/etc/awstats -config=${vhost_name}-http&quot;</code></div><br /> <br />&nbsp;&nbsp;&nbsp; 1) check if there are *.txt files in statistics/webstat directory for previous months. If there are and you wish to build statistic pages using the information stored in these data files then skip to step #4 <br /> <br />&nbsp;&nbsp;&nbsp; 2) remove all *.txt files from the statistics/webstat directory: <br /> <br /><div class="commandline"><code>find $HTTPD_VHOSTS_D/$vhost_name/statistics/webstat -name '*.txt' -exec rm -f '{}' \;</code></div><br /> <br />&nbsp;&nbsp;&nbsp; 3) find the necessary log file and analyze it with awstats: <br /> <br /><div class="commandline"><code>$awstats $awstats_gen_opts -LogFile=$HTTPD_VHOSTS_D/${vhost_name}/statistics/logs/access_log.processed</code></div><br /> <br />&nbsp;&nbsp;&nbsp; 4) create missing time stamped (in format 'YYYY-MM') directories for the period of processed log file in statistics/webstat subdirectory of virtual host: <br /> <br /><div class="commandline"><code>for y in 2007 2008 ; do for m in `seq 1 12` ; do mkdir ${HTTPD_VHOSTS_D}/${vhost_name}/statistics/webstat/$y-$(printf &quot;%.2d&quot; $m) ; done ; done</code></div><br /> <br />&nbsp;&nbsp;&nbsp; 5) run this cycle to build statistics pages: <br /> <br /><div class="commandline"><code>for y in 2007 2008 ; do \<br />&nbsp;for m in `seq -w 1 12` ; do \<br />&nbsp;&nbsp;&nbsp;&nbsp; dest_dir=$HTTPD_VHOSTS_D/$vhost_name/statistics/webstat/$y-$m ; \<br />&nbsp;&nbsp;&nbsp;&nbsp; $awstats $awstats_gen_opts -month=$m -year=$y -output &gt; $dest_dir/awstats.${vhost_name}-http.html ; \<br />&nbsp;&nbsp;&nbsp;&nbsp; ln -s $dest_dir/awstats.${vhost_name}-http.html $dest_dir/index.html ; \<br />&nbsp;&nbsp;&nbsp;&nbsp; for output in alldomains allhosts lasthosts unknownip allrobots lastrobots session urldetail urlentry urlexit osdetail unknownos refererse refererpages keyphrases keywords errors404 ; do \<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $awstats $awstats_gen_opts -month=$m -year=$y -output=$output &gt; $dest_dir/awstats.${vhost_name}-http.$output.html ; \<br />&nbsp;&nbsp;&nbsp;&nbsp; done ; \<br />&nbsp;done ; \<br />done</code></div><br /><br />&nbsp;&nbsp;&nbsp; 6) run 'statistics' command to update the upper frame navigation menu with month listing: <br /> <br /><div class="commandline"><code>$PRODUCT_ROOT_D/admin/sbin/statistics --calculate-one --domain-name=$vhost_name</code></div><br /> <br />
				</div>
			</div>
		</div><!-- article-container -->


			<br/><br/>

			<div id="SubscriptionLink24Article" class="subscriptionLink2">
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=5550&ArticleLanguage=en&Product=&Category="><img src="http://kb.parallels.com/images/mail.png" width="15" height="15" alt="Subscription for changes to this article"></a>
<a href="http://kb.parallels.com/subscriptions/index.html?Type=Article&ArticleID=5550&ArticleLanguage=en&Product=&Category=">Subscription for changes to this article</a>

<script type="text/javascript">

$(document).ready(function() {
	$('#SubscriptionLink24Article a').each(function(){
		$(this).click(function(event) {
			event.preventDefault();
			MainPageContentHide();
			$('#subscription').html('');
			$.get('/Stuff/Subscription', {
													'Type' : 'Article',
													'ArticleID' : '5550',
													'ArticleLanguage' : 'en',
													'Product' : '',
													'Category' : ''
												}, function(data) {
																	$('#subscription').html(data);
																	$('#subscription').show();
																	SUBbuildsubmenus_product();
																});
		});
	});
});

</script>

</div>





	</div><!-- kb -->

</div><!-- article -->


]]></description>
<author>Bezborodova Anastasiya</author>
<guid isPermaLink="false">5183 LastUpdated: 2009-06-23 08:29:45</guid>
<pubDate>2008-08-18 00:00:27</pubDate>
</item>
</channel>
</rss>



