<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>fabiolagana.net &#187; mail.log</title>
	<atom:link href="http://blog.fabiolagana.net/tag/maillog/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fabiolagana.net</link>
	<description>640 Kb should be enough memory for anybody</description>
	<lastBuildDate>Mon, 26 Oct 2009 13:17:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Count domain in mail.log (Qmail)</title>
		<link>http://blog.fabiolagana.net/count-domain-maillog-qmail/</link>
		<comments>http://blog.fabiolagana.net/count-domain-maillog-qmail/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 05:34:56 +0000</pubDate>
		<dc:creator>Fabio Laganà</dc:creator>
				<category><![CDATA[awk]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Mailserver]]></category>
		<category><![CDATA[Qmail]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mail.log]]></category>

		<guid isPermaLink="false">http://blog.fabiolagana.net/?p=116</guid>
		<description><![CDATA[&#160;Powered by Max Banner Ads&#160; # cat /usr/local/sbin/count_mail_per_domain.sh #!/bin/bash logfile=$2 domain=$3 &#160; case &#34;$1&#34; in -t&#41; cat $logfile &#124;grep &#34;to remote&#34; &#124; awk '{print $14}' &#124; awk -F@ '{ field = $2 }; {print &#34;domain: &#34; field }' &#124; sort &#124;uniq -c &#124;sort -nr &#124; awk -v totale=0 '{totale=totale+$1; print ;} END {print &#34;Totale giorno [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox"><table><tr id="p1162"><td class="code" id="p116code2"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cat /usr/local/sbin/count_mail_per_domain.sh</span>
<span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">logfile</span>=<span style="color: #007800;">$2</span>
<span style="color: #007800;">domain</span>=<span style="color: #007800;">$3</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
        -t<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$logfile</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;to remote&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $14}'</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> -F<span style="color: #000000; font-weight: bold;">@</span> <span style="color: #ff0000;">'{ field = $2 }; {print &quot;domain: &quot; field }'</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">uniq</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">totale</span>=<span style="color: #000000;">0</span> <span style="color: #ff0000;">'{totale=totale+$1; print ;} END {print &quot;Totale giorno domini: &quot;totale;}'</span>
            <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
        -su<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$logfile</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;to remote&quot;</span>  <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$domain</span>&quot;</span>
					<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">' { field = $14 }; {print &quot;to remote: &quot; field }'</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span> -c<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">totale</span>=<span style="color: #000000;">0</span> <span style="color: #ff0000;">'{totale=totale+$1; print ;} END {print &quot;Totale giorno domini per utente: &quot;totale;}'</span>
            <span style="color: #000000; font-weight: bold;">;;</span>
	-s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$logfile</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;to remote&quot;</span>  <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$domain</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $14}'</span>
                                        <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> -F<span style="color: #000000; font-weight: bold;">@</span> <span style="color: #ff0000;">'{ field = $2 }; {print &quot;to remote domain: &quot; field }'</span>
                                        <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span> -c<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span>
                                        <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">totale</span>=<span style="color: #000000;">0</span> <span style="color: #ff0000;">'{totale=totale+$1; print ;} END {print &quot;Totale giorno domini: &quot;totale;}'</span>
&nbsp;
         <span style="color: #000000; font-weight: bold;">;;</span>
        <span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
            <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #ff0000;">&quot;Usage: $0 { -t /var/log/mail.log.0 }  for print total mail for domain &quot;</span>
            <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #ff0000;">&quot;Usage: $0 { -su /var/log/mail.log.0 domain.com } for print total mail for single domain per user&quot;</span>
            <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #ff0000;">&quot;Usage: $0 { -s /var/log/mail.log.0 domain.com } for print total mail for single domain&quot;</span>
            <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">esac</span></pre></td></tr></table></div>

<p>for more tips visit <a title="qmail relay to smarthost" href="http://www.nixtips.net/qmail-relay-to-smarthost/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.nixtips.net/qmail-relay-to-smarthost/?referer=');">qmail relay to smarthost</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabiolagana.net/count-domain-maillog-qmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
