<?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>blog.seljebu.no</title>
	<atom:link href="http://blog.seljebu.no/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.seljebu.no</link>
	<description>useful or not so useful notes about computers and linux</description>
	<lastBuildDate>Wed, 22 May 2013 08:34:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>mounting a partclone image</title>
		<link>http://blog.seljebu.no/2013/05/mounting-a-partclone-image/</link>
		<comments>http://blog.seljebu.no/2013/05/mounting-a-partclone-image/#comments</comments>
		<pubDate>Wed, 22 May 2013 08:30:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/?p=367</guid>
		<description><![CDATA[Convert imagefile to a row dd file

sudo partclone.ntfs -r -W -s sda2.partclone.img -o sda2.img
mount -o loop sda2.img /mount/point

]]></description>
			<content:encoded><![CDATA[<p>Convert imagefile to a row dd file</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> partclone.ntfs <span style="color: #660033;">-r</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-s</span> sda2.partclone.img <span style="color: #660033;">-o</span> sda2.img
<span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-o</span> loop sda2.img <span style="color: #000000; font-weight: bold;">/</span>mount<span style="color: #000000; font-weight: bold;">/</span>point</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/mounting-a-partclone-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ignore monit in awstats</title>
		<link>http://blog.seljebu.no/2013/05/ignore-monit-in-awstats/</link>
		<comments>http://blog.seljebu.no/2013/05/ignore-monit-in-awstats/#comments</comments>
		<pubDate>Wed, 22 May 2013 08:23:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[server]]></category>
		<category><![CDATA[server monit awstats]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/?p=32</guid>
		<description><![CDATA[Find monit user agent in apache access.log.
awstats.conf:

SkipUserAgents=&#34;monit/5.0.3&#34;

]]></description>
			<content:encoded><![CDATA[<p>Find monit user agent in apache access.log.</p>
<p>awstats.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SkipUserAgents</span>=<span style="color: #ff0000;">&quot;monit/5.0.3&quot;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/ignore-monit-in-awstats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>netatalk 3.0.3 Ubuntu 12.04.2/10.04.3 LTS (Precise Pangolin)</title>
		<link>http://blog.seljebu.no/2013/05/netatalk-3-0-3-ubuntu-12-04-2-lts-precise-pangolin/</link>
		<comments>http://blog.seljebu.no/2013/05/netatalk-3-0-3-ubuntu-12-04-2-lts-precise-pangolin/#comments</comments>
		<pubDate>Mon, 20 May 2013 21:10:37 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/2013/05/netatalk-3-0-3-ubuntu-12-04-2-lts-precise-pangolin/</guid>
		<description><![CDATA[Netatalk for use with Time Machine on MAC OSX Mountain Lion 10.8.3.

sudo -i
apt-get install build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libdb5.1-dev db-util db5.1-util libgcrypt11 libgcrypt11-dev
wget http://prdownloads.sourceforge.net/netatalk/netatalk-3.0.3.tar.bz2?download
tar jxvf netatalk-3.0.3.tar.bz2?download
mv netatalk-3.0.3 /usr/src
cd /usr/src/netatalk-3.0.3
./configure --with-init-style=debian --with-zeroconf
make
checkinstall
exit

/usr/local/etc/afp.conf:

1
2
3
4
5
6
7
8
9
10
&#91;Global&#93;
mimic model = TimeCapsule6,106
log level = default:warn
log file = /var/log/afpd.log
hosts allow = 192.168.1.0/16
&#160;
&#91;TimeMachine&#93;
path = /mnt/timemachine
valid users = tmuser
time machine = yes

For Ubuntu 10.04.03 [...]]]></description>
			<content:encoded><![CDATA[<p>Netatalk for use with Time Machine on MAC OSX Mountain Lion 10.8.3.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-i</span>
<span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libdb5.1-dev db-util db5.1-util libgcrypt11 libgcrypt11-dev
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>prdownloads.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>netatalk<span style="color: #000000; font-weight: bold;">/</span>netatalk-3.0.3.tar.bz2?download
<span style="color: #c20cb9; font-weight: bold;">tar</span> jxvf netatalk-3.0.3.tar.bz2?download
<span style="color: #c20cb9; font-weight: bold;">mv</span> netatalk-3.0.3 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>netatalk-3.0.3
.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--with-init-style</span>=debian <span style="color: #660033;">--with-zeroconf</span>
<span style="color: #c20cb9; font-weight: bold;">make</span>
checkinstall
<span style="color: #7a0874; font-weight: bold;">exit</span></pre></div></div>

<p>/usr/local/etc/afp.conf:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>Global<span style="color: #7a0874; font-weight: bold;">&#93;</span>
mimic model = TimeCapsule6,<span style="color: #000000;">106</span>
log level = default:warn
log <span style="color: #c20cb9; font-weight: bold;">file</span> = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>afpd.log
hosts allow = 192.168.1.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">16</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>TimeMachine<span style="color: #7a0874; font-weight: bold;">&#93;</span>
path = <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>timemachine
valid <span style="color: #c20cb9; font-weight: bold;">users</span> = tmuser
<span style="color: #000000; font-weight: bold;">time</span> machine = <span style="color: #c20cb9; font-weight: bold;">yes</span></pre></td></tr></table></div>

<p>For Ubuntu 10.04.03 use this apt-get line instead:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential pkg-config checkinstall git-core avahi-daemon libavahi-client-dev libdb4.8-dev db4.8-util libgcrypt11 libgcrypt11-dev</pre></div></div>

<p>Resource:<br />
<a href="https://gist.github.com/vena/2856490">https://gist.github.com/vena/2856490</a><br />
<a href="https://wiki.archlinux.org/index.php/Netatalk#Netatalk">https://wiki.archlinux.org/index.php/Netatalk#Netatalk</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/netatalk-3-0-3-ubuntu-12-04-2-lts-precise-pangolin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Learn spamassasin</title>
		<link>http://blog.seljebu.no/2013/05/learn-spamassasin/</link>
		<comments>http://blog.seljebu.no/2013/05/learn-spamassasin/#comments</comments>
		<pubDate>Mon, 20 May 2013 08:53:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/2013/05/learn-spamassasin/</guid>
		<description><![CDATA[sa-learn --no-sync --spam /folder/to/.Spam/
sa-learn --no-sync --ham /forlder/to/ham
sa-learn --sync
]]></description>
			<content:encoded><![CDATA[<p>sa-learn --no-sync --spam /folder/to/.Spam/<br />
sa-learn --no-sync --ham /forlder/to/ham<br />
sa-learn --sync</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/learn-spamassasin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery slideshow</title>
		<link>http://blog.seljebu.no/2013/05/jquery-slideshow/</link>
		<comments>http://blog.seljebu.no/2013/05/jquery-slideshow/#comments</comments>
		<pubDate>Sat, 18 May 2013 22:26:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[coding]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/2013/05/jquery-slideshow/</guid>
		<description><![CDATA[JavaScript:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
var bilder = &#91; // bildene våre
        &#34;img/1.jpg&#34;,
        &#34;img/2.jpg&#34;,
        &#34;img/3.jpg&#34;,
        &#34;img/4.jpg&#34; 
        &#93;;
var i=0; // teller
&#160;
setInterval&#40;pictureSlide, 5000&#41;; // kjør pictureSlide() [...]]]></description>
			<content:encoded><![CDATA[<p>JavaScript:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> bilder <span style="color: #339933;">=</span> <span style="color: #009900;">&#91;</span> <span style="color: #006600; font-style: italic;">// bildene våre</span>
        <span style="color: #3366CC;">&quot;img/1.jpg&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #3366CC;">&quot;img/2.jpg&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #3366CC;">&quot;img/3.jpg&quot;</span><span style="color: #339933;">,</span>
        <span style="color: #3366CC;">&quot;img/4.jpg&quot;</span> 
        <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// teller</span>
&nbsp;
setInterval<span style="color: #009900;">&#40;</span>pictureSlide<span style="color: #339933;">,</span> <span style="color: #CC0000;">5000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// kjør pictureSlide() hvert 5 sekund</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> pictureSlide<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  i<span style="color: #339933;">++;</span> <span style="color: #006600; font-style: italic;">// øk teller</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">==</span> bilder.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #006600; font-style: italic;">// sett til 0 hvis vi har gått rundt</span>
  <span style="color: #003366; font-weight: bold;">var</span> currentImage <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#slideshow &gt; img'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> nextImage <span style="color: #339933;">=</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;img src=&quot;'</span> <span style="color: #339933;">+</span> bilder<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot;&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// lag det nye bildet</span>
  nextImage.<span style="color: #660066;">hide</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// gjem det</span>
  $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'#slideshow'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">prepend</span><span style="color: #009900;">&#40;</span>nextImage<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// legg til bildet</span>
  nextImage.<span style="color: #660066;">fadeIn</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">5000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// fade inn</span>
  currentImage.<span style="color: #660066;">fadeOut</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">5000</span><span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">remove</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">// fade ut gammelt bilde samtidig, og fjern etterpå</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #cc00cc;">#slideshow</span> img <span style="color: #00AA00;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">absolute</span><span style="color: #00AA00;">;</span> // plasserer bildene <span style="color: #ff0000;">&quot;oppå&quot;</span> hverandre
<span style="color: #00AA00;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/jquery-slideshow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable adobe update manager startup</title>
		<link>http://blog.seljebu.no/2013/05/disable-adobe-updater/</link>
		<comments>http://blog.seljebu.no/2013/05/disable-adobe-updater/#comments</comments>
		<pubDate>Sat, 18 May 2013 16:25:34 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[desktop]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/2013/05/disable-adobe-updater/</guid>
		<description><![CDATA[
rm ~/Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist

]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">rm</span> ~<span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>LaunchAgents<span style="color: #000000; font-weight: bold;">/</span>com.adobe.AAM.Updater-<span style="color: #000000;">1.0</span>.plist</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/disable-adobe-updater/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SSH fingerprint</title>
		<link>http://blog.seljebu.no/2013/05/ssh-fingerprint/</link>
		<comments>http://blog.seljebu.no/2013/05/ssh-fingerprint/#comments</comments>
		<pubDate>Wed, 15 May 2013 19:53:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/2013/05/ssh-fingerprint/</guid>
		<description><![CDATA[To view the fingerprint of a SSH-key:

ssh-keygen -l -f id_dsa.pub

]]></description>
			<content:encoded><![CDATA[<p>To view the fingerprint of a SSH-key:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-l</span> <span style="color: #660033;">-f</span> id_dsa.pub</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/ssh-fingerprint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prevent ._DS_STORE on OSX</title>
		<link>http://blog.seljebu.no/2013/05/prevent-_ds_store-on-osx/</link>
		<comments>http://blog.seljebu.no/2013/05/prevent-_ds_store-on-osx/#comments</comments>
		<pubDate>Mon, 13 May 2013 19:25:16 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[desktop]]></category>
		<category><![CDATA[mac]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/2013/05/prevent-_ds_store-on-osx/</guid>
		<description><![CDATA[
defaults write com.apple.desktopservices DSDontWriteNetworkStores true

]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">defaults <span style="color: #c20cb9; font-weight: bold;">write</span> com.apple.desktopservices DSDontWriteNetworkStores <span style="color: #c20cb9; font-weight: bold;">true</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/prevent-_ds_store-on-osx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sort merged apache log-file by date</title>
		<link>http://blog.seljebu.no/2013/05/sort-merged-apache-log-file-by-date/</link>
		<comments>http://blog.seljebu.no/2013/05/sort-merged-apache-log-file-by-date/#comments</comments>
		<pubDate>Sat, 11 May 2013 10:53:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/2013/05/sort-merged-apache-log-file-by-date/</guid>
		<description><![CDATA[
1
2
3
4
5
6
7
#!/bin/bash
if &#91;&#91; $2 == &#34;&#34; &#124;&#124; $1 == &#34;&#34; &#93;&#93; &#124;&#124; &#91; ! -f $1 &#93;; then
    echo &#34;Usage: $0 input-file output-file&#34;
    exit
fi
echo &#34;Sorting $1&#34;
sort -t ' ' -k 4.9,4.12n -k 4.5,4.7M -k 4.2,4.3n -k 4.14,4.15n -k 4.17,4.18n -k 4.20,4.21n $1 &#62; $2

Reference: http://stackoverflow.com/questions/5672733/how-can-i-sort-an-apache-log-file-by-date
]]></description>
			<content:encoded><![CDATA[
<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$2</span> == <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">$1</span> == <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 input-file output-file&quot;</span>
    <span style="color: #7a0874; font-weight: bold;">exit</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Sorting $1&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-t</span> <span style="color: #ff0000;">' '</span> <span style="color: #660033;">-k</span> <span style="color: #000000;">4.9</span>,4.12n <span style="color: #660033;">-k</span> <span style="color: #000000;">4.5</span>,4.7M <span style="color: #660033;">-k</span> <span style="color: #000000;">4.2</span>,4.3n <span style="color: #660033;">-k</span> <span style="color: #000000;">4.14</span>,4.15n <span style="color: #660033;">-k</span> <span style="color: #000000;">4.17</span>,4.18n <span style="color: #660033;">-k</span> <span style="color: #000000;">4.20</span>,4.21n <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$2</span></pre></td></tr></table></div>

<p>Reference: http://stackoverflow.com/questions/5672733/how-can-i-sort-an-apache-log-file-by-date</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/sort-merged-apache-log-file-by-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parse old gzipped apache(vhost_combined) logs with awstats</title>
		<link>http://blog.seljebu.no/2013/05/parse-old-gzipped-apachevhost_combined-logs-with-awstats/</link>
		<comments>http://blog.seljebu.no/2013/05/parse-old-gzipped-apachevhost_combined-logs-with-awstats/#comments</comments>
		<pubDate>Sat, 11 May 2013 10:18:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.seljebu.no/?p=401</guid>
		<description><![CDATA[Parse all logs to new log-file in chronological order.

zgrep ^blog.seljebu.no `find -name &#34;other_vhosts_access.log.[0-9]*.gz&#34; &#124; sort -n -t . -k 4 -r` &#124; sed 's/\.\/other_vhosts_access.log.[0-9]*.gz:blog.seljebu.no:80 //g' &#62; blog.seljebu.no/old.log
grep ^blog.seljebu.no other_vhosts_access.log.1 &#124; sed 's/blog.seljebu.no:80 //g' &#62;&#62; blog.seljebu.no/old.log
grep ^blog.seljebu.no other_vhosts_access.log &#124; sed 's/blog.seljebu.no:80 //g' &#62;&#62; blog.seljebu.no/old.log

Make config-file for awstats.

1
2
3
4
5
6
#/etc/awstats/awstats.blog.seljebu.no.conf
LogFile=&#34;/var/log/apache2/blog.seljebu.no/old.log&#34;
LogFormat=1
SiteDomain=&#34;blog.seljebu.no&#34;
HostAliases=&#34;blog.seljebu.no&#34;
DirData=/var/lib/awstats

Delete awstats database and update awstats. If you get a [...]]]></description>
			<content:encoded><![CDATA[<p>Parse all logs to new log-file in chronological order.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">zgrep</span> ^blog.seljebu.no <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">find</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;other_vhosts_access.log.[0-9]*.gz&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-n</span> <span style="color: #660033;">-t</span> . <span style="color: #660033;">-k</span> <span style="color: #000000;">4</span> -r<span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/\.\/other_vhosts_access.log.[0-9]*.gz:blog.seljebu.no:80 //g'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> blog.seljebu.no<span style="color: #000000; font-weight: bold;">/</span>old.log
<span style="color: #c20cb9; font-weight: bold;">grep</span> ^blog.seljebu.no other_vhosts_access.log.1 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/blog.seljebu.no:80 //g'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> blog.seljebu.no<span style="color: #000000; font-weight: bold;">/</span>old.log
<span style="color: #c20cb9; font-weight: bold;">grep</span> ^blog.seljebu.no other_vhosts_access.log <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/blog.seljebu.no:80 //g'</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> blog.seljebu.no<span style="color: #000000; font-weight: bold;">/</span>old.log</pre></div></div>

<p>Make config-file for awstats.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#/etc/awstats/awstats.blog.seljebu.no.conf</span>
<span style="color: #007800;">LogFile</span>=<span style="color: #ff0000;">&quot;/var/log/apache2/blog.seljebu.no/old.log&quot;</span>
<span style="color: #007800;">LogFormat</span>=<span style="color: #000000;">1</span>
<span style="color: #007800;">SiteDomain</span>=<span style="color: #ff0000;">&quot;blog.seljebu.no&quot;</span>
<span style="color: #007800;">HostAliases</span>=<span style="color: #ff0000;">&quot;blog.seljebu.no&quot;</span>
<span style="color: #007800;">DirData</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>awstats</pre></td></tr></table></div>

<p>Delete awstats database and update awstats. If you get a lot of corrupted/dropped records, you could use -showcorrupted/-showdropped.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">/</span>awstats<span style="color: #000000; font-weight: bold;">*</span>blog.seljebu.no<span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>cgi-bin<span style="color: #000000; font-weight: bold;">/</span>awstats.pl <span style="color: #660033;">-config</span>=blog.seljebu.no <span style="color: #660033;">-update</span></pre></div></div>

<p>Make individual log-files for virtualhosts.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>VirtualHost <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">80</span><span style="color: #000000; font-weight: bold;">&gt;</span>
        Servername blog.seljebu.no
        CustomLog <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>blog.seljebu.no<span style="color: #000000; font-weight: bold;">/</span>access.log combined
        ...
<span style="color: #000000; font-weight: bold;">&lt;/</span>VirtualHost<span style="color: #000000; font-weight: bold;">&gt;</span></pre></td></tr></table></div>

<p>Add new log files to logrotate.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#/etc/logrotate.d/apache2 </span>
<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/*/*</span>.log <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/*</span>.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        weekly
        ...
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Update awstats config-file.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#/etc/awstats/awstats.blog.seljebu.no.conf</span>
<span style="color: #007800;">LogFile</span>=<span style="color: #ff0000;">&quot;/var/log/apache2/blog.seljebu.no/access.log&quot;</span>
...</pre></td></tr></table></div>

<p>Add to cron.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#/etc/cron.d/awstats</span>
<span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">10</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> www-data <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>cgi-bin<span style="color: #000000; font-weight: bold;">/</span>awstats.pl <span style="color: #660033;">-config</span>=blog.seljebu.no <span style="color: #660033;">-update</span> <span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.seljebu.no/2013/05/parse-old-gzipped-apachevhost_combined-logs-with-awstats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
