<?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>MrBrown blob &#187; Logs</title>
	<atom:link href="http://charles.lescampeurs.org/category/logs/feed" rel="self" type="application/rss+xml" />
	<link>http://charles.lescampeurs.org</link>
	<description>random bits.</description>
	<lastBuildDate>Thu, 02 Feb 2012 14:34:09 +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>About user agent strings</title>
		<link>http://charles.lescampeurs.org/2008/09/22/about-user-agent-strings?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=about-user-agent-strings</link>
		<comments>http://charles.lescampeurs.org/2008/09/22/about-user-agent-strings#comments</comments>
		<pubDate>Mon, 22 Sep 2008 05:48:12 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Logs]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[bandwidth]]></category>
		<category><![CDATA[user agent]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=73</guid>
		<description><![CDATA[I was surprised when I saw the length of the Chrome user agent string last week: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.X.Y.Z Safari/525.13 And in our logs: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.29 Safari/525.13 a user agent string of 119 characters. It looks [...]]]></description>
			<content:encoded><![CDATA[<p>I was surprised when I saw the length of the Chrome user agent string last week:</p>
<pre>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.X.Y.Z Safari/525.13</pre>
<p>And in our logs:</p>
<pre>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/525.13 (KHTML, like Gecko) Chrome/0.2.149.29 Safari/525.13</pre>
<p>a user agent string of 119 characters. It looks quite a waste of space but is Google Chrome the only one? Surprisingly, Chrome is far from the worst.</p>
<p>Best of one of our log file:</p>
<ul>
<li>641 characters: <em>Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4 GoogleToolbarFF 3.0.20070420 GoogleToolbarFF 3.0.20070420 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525 GoogleToolbarFF 3.0.20070525</em></li>
<li>337 characters: <em>Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; DA4BB049-ADVLOVER|0001|DSL; C:\DOCUME~1\everey\CONFIG~1\Temp\; C:\DOCUME~1\zulcan\CONFIG~1\Temp\; C:\DOCUME~1\nilfer\CONFIG~1\Temp\; C:\DOCUME~1\mirmor\CONFIG~1\Temp\; C:\DOCUME~1\ASTNU~1\CONFIG~1\Temp\; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727)</em></li>
<li>290 characters: <em>Mozilla/5.0 (Windows; U LupinV2.u2/20080827 LupinV2.u2/20080828 LupinV2.u2/20080829 LupinV2.u2/20080830 LupinV2.u2/20080831 LupinV2.u2/20080902 LupinV2.u2/20080903 LupinV2.u2/20080909 LupinV2.u2/20080911 LupinV2.u2/20080912; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1</em></li>
<li>272 characters: <em>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; FunWebProducts; SU 3.011; User-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; http://bsalsa.com) ; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 1.1.4322; .NET CLR 3.5.30428; .NET CLR 3.0.30422)</em></li>
<li>202 characters: <em>Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; Media Center PC 4.0; IE7-01NET.COM-1.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; InfoPath.2; IE7-01NET.COM-1.1)</em></li>
</ul>
<h2>The full list</h2>
<ul>
<li>Download the <a href="http://charles.lescampeurs.org/wp-content/uploads/2008/09/agentlog.gz">user agent log</a> (gzip format)</li>
</ul>
<h2>How to extract user agent strings from a HTTP log file?</h2>
<ul>
<li>Print user agent strings with its length:</li>
</ul>
<pre>awk -F\" '{print length($6)" "$6}'  access.log</pre>
<ul>
<li>print user agent strings that are more than 200 characters length:</li>
</ul>
<pre>awk -F\" '{if ($6 &gt; 200) print length($6)" "$6}'  access.log</pre>
<p>In those examples, the access.log file has this log format:</p>
<pre>xxx.xxx.xxx.xxx \
www.domain.com - \
[15/Sep/2008:00:00:00 +0200] \
"GET / HTTP/1.1" 200 4242 \
"http://www.domain.com/" \
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"</pre>
<h2>About bandwith</h2>
<p>If you take an average user agent string likes the Firefox one, you have a 91 charaters string.</p>
<ul>
<li>How many entries with a user agent string longer than 120 characters: 249586</li>
</ul>
<pre>awk -F\" '{if (length($6) &gt; 120) print length($6)}' access.log | wc -l</pre>
<ul>
<li>Size waste with string longer than 120 characters: 5.67 M</li>
</ul>
<pre>awk -F\" '{if (length($6) &gt; 120) SUM += length($6)-120} END {print SUM/1024/1024" Mo"}'  access.log</pre>
<ul>
<li>Bandwidth waste per month for this server: 170M&#8230;</li>
</ul>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=73" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2008/09/22/about-user-agent-strings/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using Logcheck</title>
		<link>http://charles.lescampeurs.org/2008/09/16/using-logcheck?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=using-logcheck</link>
		<comments>http://charles.lescampeurs.org/2008/09/16/using-logcheck#comments</comments>
		<pubDate>Tue, 16 Sep 2008 09:22:15 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Logs]]></category>
		<category><![CDATA[logcheck]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=67</guid>
		<description><![CDATA[Logcheck is a tool to parse system logs and send summaries by email. It filters out logs with a regular expressions database to suppress common/normal entries. Are you reading / checking your log files? Too many servers? logcheck will help you in this task and eliminates the noise. Installing on Debian # apt-get install logcheck [...]]]></description>
			<content:encoded><![CDATA[<p><a title="logcheck tool" href="http://logcheck.org/" target="_blank">Logcheck</a> is a tool to parse system logs and send summaries by email. It filters out logs with a regular expressions database to suppress common/normal entries.</p>
<p>Are you reading / checking your log files? Too many servers? logcheck will help you in this task and eliminates the noise.</p>
<h2>Installing on Debian</h2>
<pre># apt-get install logcheck
Reading package lists... Done
Building dependency tree... Done
The following extra packages will be installed:
lockfile-progs logtail
Suggested packages:
syslog-summary
Recommended packages:
logcheck-database
The following NEW packages will be installed:
lockfile-progs logcheck logtail
0 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.
Need to get 110kB of archives.
After unpacking 428kB of additional disk space will be used.
Do you want to continue [Y/n]?</pre>
<p>Also install logcheck-database which contains lots of rules</p>
<pre># apt-get install logcheck-database</pre>
<h2>Config files</h2>
<ul>
<li>/etc/logcheck/logcheck.conf
<ul>
<li>SENDMAILTO=&#8221;root&#8221; &#8211; <em>your email address</em></li>
</ul>
</li>
<li>/etc/logcheck/logcheck.logfiles
<ul>
<li><em>configure which logfiles to analyze</em></li>
</ul>
</li>
<li>/etc/cron.d/logcheck
<ul>
<li>logcheck cron (by default, logcheck runs every hour)</li>
</ul>
</li>
</ul>
<p>You can try it by executing the following command:</p>
<pre># su -s /bin/bash -c "/usr/sbin/logcheck" logcheck</pre>
<p>Your mailbox should now contains a report from logcheck if some unusual log entries have been found.</p>
<h2>Links</h2>
<ul>
<li><a title="logcheck wiki" href="http://wiki.logcheck.org/" target="_blank">logcheck wiki</a></li>
</ul>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=67" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2008/09/16/using-logcheck/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Rotate Nginx log files under FreeBSD</title>
		<link>http://charles.lescampeurs.org/2008/07/17/rotate-nginx-log-files-under-freebsd?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rotate-nginx-log-files-under-freebsd</link>
		<comments>http://charles.lescampeurs.org/2008/07/17/rotate-nginx-log-files-under-freebsd#comments</comments>
		<pubDate>Thu, 17 Jul 2008 05:15:12 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[Logs]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[newsyslog]]></category>
		<category><![CDATA[nginx]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=27</guid>
		<description><![CDATA[To rotate your nginx log files, you can use the log file handler provided by FreeBSD: newsyslog. Configuring /etc/newsyslog.conf /var/log/nginx-access.log               644  7     1024 *     JC /var/run/nginx.pid /var/log/nginx-error.log                644  7     1024 *     JC /var/run/nginx.pid Before log rotation: -rw-r--r--  1 root  wheel    104278002 Jul 16 11:35 nginx-access.log -rw-r--r--  1 root  wheel      1509531 Jul 16 11:17 nginx-error.log After [...]]]></description>
			<content:encoded><![CDATA[<p>To rotate your nginx log files, you can use the log file handler provided by FreeBSD: newsyslog.</p>
<h2>Configuring /etc/newsyslog.conf</h2>
<pre>/var/log/nginx-access.log               644  7     1024 *     JC /var/run/nginx.pid
/var/log/nginx-error.log                644  7     1024 *     JC /var/run/nginx.pid</pre>
<p>Before log rotation:</p>
<pre>-rw-r--r--  1 root  wheel    104278002 Jul 16 11:35 nginx-access.log
-rw-r--r--  1 root  wheel      1509531 Jul 16 11:17 nginx-error.log</pre>
<p>After log rotation:</p>
<pre>-rw-r--r--  1 root  wheel        967 Jul 16 12:42 nginx-access.log
-rw-r--r--  1 root  wheel    5310443 Jul 16 12:41 nginx-access.log.0.bz2
-rw-r--r--  1 root  wheel         77 Jul 16 12:41 nginx-error.log
-rw-r--r--  1 root  wheel      37552 Jul 16 12:41 nginx-error.log.0.bz2</pre>
<h2>Links</h2>
<ul>
<li><a title="FreeBSD newsyslog man page" href="http://www.freebsd.org/cgi/man.cgi?query=newsyslog&amp;sektion=8&amp;apropos=0&amp;manpath=FreeBSD+7.0-RELEASE" target="_blank">newsyslog man page</a></li>
<li><a title="FreeBSD newsyslog.conf man page" href="http://www.freebsd.org/cgi/man.cgi?query=newsyslog.conf&amp;sektion=5&amp;apropos=0&amp;manpath=FreeBSD+7.0-RELEASE" target="_blank">newsyslog.conf man page</a></li>
</ul>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=27" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2008/07/17/rotate-nginx-log-files-under-freebsd/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rotate Apache logs with Cronolog</title>
		<link>http://charles.lescampeurs.org/2008/06/04/rotate-apache-logs-with-cronolog?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rotate-apache-logs-with-cronolog</link>
		<comments>http://charles.lescampeurs.org/2008/06/04/rotate-apache-logs-with-cronolog#comments</comments>
		<pubDate>Wed, 04 Jun 2008 05:33:20 +0000</pubDate>
		<dc:creator>CharlyBr</dc:creator>
				<category><![CDATA[http]]></category>
		<category><![CDATA[Logs]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cronolog]]></category>

		<guid isPermaLink="false">http://charles.lescampeurs.org/?p=20</guid>
		<description><![CDATA[Cronolog is log rotation program which gives you a lot of options to template the log destination files. The common use is to split logs by year / month / day. Here is how to configure Apache to send log entries to cronolog : CustomLog "&#124;/usr/sbin/cronolog /home/log/apache2/%Y-%m-%d_domain.com_access.log" combined This will create a log file named [...]]]></description>
			<content:encoded><![CDATA[<p><a title="cronolog log rotation" href="http://cronolog.org/" target="_blank">Cronolog</a> is log rotation program which gives you a lot of options to template the log destination files. The common use is to split logs by year / month / day.</p>
<p>Here is how to configure Apache to send log entries to cronolog :</p>
<pre>CustomLog "|/usr/sbin/cronolog /home/log/apache2/%Y-%m-%d_domain.com_access.log" combined</pre>
<p>This will create a log file named <em>2008-06-02_domain.com_access.log</em> for today.</p>
<p>Cronolog reads log entries from standard input and writes them to the output file specified by your template.</p>
<h2>More examples</h2>
<ul>
<li>Rotate by month :</li>
</ul>
<pre>CustomLog "|/usr/sbin/cronolog /home/log/apache2/%Y-%m_domain.com_access.log" combined</pre>
<ul>
<li>Rotate by week number :</li>
</ul>
<pre>CustomLog "|/usr/sbin/cronolog /home/log/apache2/%Y-%W_domain.com_access.log" combined</pre>
<ul>
<li>Rotate hourly</li>
</ul>
<pre>CustomLog "|/usr/sbin/cronolog /home/log/apache2/%H_domain.com_access.log" combined</pre>
<h2>Links</h2>
<ul>
<li><a title="cronolog usage" href="http://cronolog.org/usage.html" target="_blank">All cronolog templating flags</a></li>
<li><a title="Apache 2 mod_log_config" href="http://httpd.apache.org/docs/2.0/mod/mod_log_config.html" target="_blank">Apache 2 mod_log_config documentation</a></li>
</ul>
 <img src="http://charles.lescampeurs.org/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=20" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://charles.lescampeurs.org/2008/06/04/rotate-apache-logs-with-cronolog/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

