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

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
<channel>
    <title>freebsd.munk.me.uk - Serendipity</title>
    <link>http://freebsd.munk.me.uk/</link>
    <description>FreeBSD System Administration</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.2 - http://www.s9y.org/</generator>
    
    <image>
        <url>http://freebsd.munk.me.uk/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: freebsd.munk.me.uk - Serendipity - FreeBSD System Administration</title>
        <link>http://freebsd.munk.me.uk/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>Customizing FreeBSD Port Installations With Patch Files</title>
    <link>http://freebsd.munk.me.uk/archives/178-Customizing-FreeBSD-Port-Installations-With-Patch-Files.html</link>
            <category>Ports</category>
            <category>Serendipity</category>
    
    <comments>http://freebsd.munk.me.uk/archives/178-Customizing-FreeBSD-Port-Installations-With-Patch-Files.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=178</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=178</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    -&lt;br /&gt;
&lt;em&gt;This article presumes the reader has a good working knowledge of the FreeBSD ports system.  For more information see &lt;a href=&quot;http://www.freebsd.org/cgi/man.cgi?query=ports&amp;sektion=7&quot;  title=&quot;ports(7) manpage&quot;&gt;the ports manpage&lt;/a&gt;, &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html&quot;  title=&quot;Using the FreeBSD ports&quot;&gt;the FreeBSD handbooks section on ports&lt;/a&gt; and &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/porters-handbook/index.html&quot;  title=&quot;FreeBSD Porters Handbook&quot;&gt;the FreeBSD porters handbook&lt;/a&gt;.&lt;/em&gt;&lt;br /&gt;
-&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html&quot;  title=&quot;Using the FreeBSD ports&quot;&gt;The FreeBSD ports tree&lt;/a&gt; is great, but when it comes to making changes to the files that are installed by a port you have to be careful so as not to lose any changes when you upgrade.  Say you install a port like the &lt;a href=&quot;http://s9y.org&quot;  title=&quot;Serendipity Weblog&quot;&gt;Serendipity weblog software&lt;/a&gt;, then go to &lt;a href=&quot;http://s9y.org/121.html&quot;  title=&quot;Editing Serendipity Weblog templates&quot;&gt;modify a template&lt;/a&gt;.  Everything works great but unfortunately when you next use &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html#PORTUPGRADE&quot;  title=&quot;Upgrading FreeBSD ports using portupgrade&quot;&gt;portupgrade&lt;/a&gt; you find the changes you made were all clobbered by the upgrade!  Not good.&lt;br /&gt;
&lt;br /&gt;
There are a few solutions to this problem, but probably the most natural method - in terms of keeping with the ports system and your own changes in harmony - is to create your own custom patch files and place them inside the &lt;a href=&quot;http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ports-using.html#PORTS-SKELETON&quot;  title=&quot;Port files directory&quot;&gt;port&#039;s &#039;files&#039; directory&lt;/a&gt;.  This way when you install or upgrade a port, the files you want patching to include your modifications will automatically be patched.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s a simple example using this weblog, Serendipity.  I want to modify the template I&#039;m using so it includes a &lt;a href=&quot;http://www.google.com/analytics/&quot;  title=&quot;Google Analytics&quot;&gt;Google Analytics&lt;/a&gt; tracker in each and every page to help track web usage.  The easiest way to do this is to modify the index.tpl file so it includes the analytics tracker code just before the closing &amp;lt;/body&amp;gt; tag of the index.tpl file.&lt;br /&gt;
&lt;br /&gt;
To make the changes permanent after an upgrade, instead of just going ahead and modifying the &#039;live&#039; index.tpl that&#039;s already installed I&#039;m going to make the changes to the index.tpl file located in the serendipity ports working directory &#039;work&#039; and then create a patch file that will transform the original index.tpl to the modified index.tpl.  &lt;br /&gt;
&lt;br /&gt;
To do this step by step:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;Ensure the working directory for serendipity is available - to do this run &#039;make extract&#039; to extract the distfile&#039;s contents into the &#039;work&#039; directory:&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@users&amp;#160;/home/munk/ports/www/serendipity#&amp;#160;cd&amp;#160;/usr/ports/www/serendipity/&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/serendipity#&amp;#160;make&amp;#160;extract&lt;br /&gt;
===&amp;#62;&amp;#160;&amp;#160;Found&amp;#160;saved&amp;#160;configuration&amp;#160;for&amp;#160;serendipity-1.0.1&lt;br /&gt;
===&amp;#62;&amp;#160;&amp;#160;Extracting&amp;#160;for&amp;#160;serendipity-1.0.1&lt;br /&gt;
=&amp;#62;&amp;#160;MD5&amp;#160;Checksum&amp;#160;OK&amp;#160;for&amp;#160;serendipity-1.0.1.tar.gz.&lt;br /&gt;
=&amp;#62;&amp;#160;SHA256&amp;#160;Checksum&amp;#160;OK&amp;#160;for&amp;#160;serendipity-1.0.1.tar.gz.&lt;/div&gt;&lt;br /&gt;
&lt;li/&gt; Move into the template directory and create a copy of the file you want to modify, naming it &amp;lt;file&amp;gt;.orig, where &amp;lt;file&amp;gt; is the name of the file to be modified:&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@users&amp;#160;/home/munk/ports/www/serendipity#&amp;#160;cd&amp;#160;work/serendipity/templates/contest/&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/serendipity/work/serendipity/templates/contest#&amp;#160;cp&amp;#160;index.tpl&amp;#160;&lt;br /&gt;
index.tpl.orig&lt;/div&gt;&lt;br /&gt;
&lt;li/&gt;Make the changes to the file you&#039;re modifying - note NOT the &lt;file&gt;.orig file! - in this case I need to make changes to index.tpl to add the following before the ending &lt;/body&gt; tag:&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&amp;#60;script&amp;#160;src=&quot;http&amp;#58;//www.google-analytics.com/urchin.js&quot;&amp;#160;type=&quot;text/javascript&quot;&amp;#62;&lt;br /&gt;
&amp;#60;/script&amp;#62;&lt;br /&gt;
&amp;#60;script&amp;#160;type=&quot;text/javascript&quot;&amp;#62;&lt;br /&gt;
_uacct&amp;#160;=&amp;#160;&quot;UA-XXXXXX-1&quot;;&lt;br /&gt;
urchinTracker&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;#60;/script&amp;#62;&lt;/div&gt;&lt;br /&gt;
&lt;li/&gt;Create a patch file in the &#039;files&#039; directory of the port containing the unified diffs between the original file and the modified file.  &lt;br /&gt;
&lt;strong&gt;Notes:&lt;/strong&gt;&lt;br /&gt;
&lt;ol&gt;&lt;li/&gt;The name of the patch file MUST begin with &#039;patch-&#039; to be treated as a patch file.  The rest of the filename should reasonably indicate what the patch file contains.  In my case I&#039;ll call the patch file &#039;patch-templates_contest_index.tpl&#039;.&lt;br /&gt;
&lt;li/&gt;The patch must be made relative to the directory into which the port&#039;s distfile was extracted - if in doubt check over other port&#039;s patch files to see how they do it!&lt;br /&gt;
&lt;li/&gt;Make sure the .orig file is first in the diff command&lt;/ol&gt;&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;root@users&amp;#160;/home/munk/ports/www/serendipity/work/serendipity/templates/contest#&amp;#160;cd&amp;#160;../..&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/serendipity/work/serendipity#&amp;#160;diff&amp;#160;-u&amp;#160;templates/contest/index.tpl.orig&amp;#160;templates/contest/index.tpl&amp;#160;&amp;#62;&amp;#160;usr/ports/www/serendipity/files/patch-templates_contest_index.tpl&lt;br /&gt;
root@users&amp;#160;/home/munk/ports/www/serendipity/work/serendipity#&amp;#160;cat&amp;#160;/usr/ports/www/serendipity/files/patch-templates_contest_index.tpl&lt;br /&gt;
---&amp;#160;templates/contest/index.tpl.orig&amp;#160;&amp;#160;&amp;#160;&amp;#160;Thu&amp;#160;Sep&amp;#160;&amp;#160;7&amp;#160;03&amp;#58;13&amp;#58;56&amp;#160;2006&lt;br /&gt;
+++&amp;#160;templates/contest/index.tpl&amp;#160;Thu&amp;#160;Sep&amp;#160;&amp;#160;7&amp;#160;03&amp;#58;14&amp;#58;08&amp;#160;2006&lt;br /&gt;
@@&amp;#160;-52,6&amp;#160;+52,13&amp;#160;@@&lt;br /&gt;
&amp;#160;&amp;#60;div&amp;#160;id=&quot;copyright&quot;&amp;#62;Design&amp;#160;&amp;#60;a&amp;#160;href=&quot;http&amp;#58;//garv.in/&quot;&amp;#62;Garvin&amp;#160;Hicking&amp;#60;/a&amp;#62;,&amp;#160;Icons&amp;#160;&lt;br /&gt;
&amp;#60;a&amp;#160;href=&quot;http&amp;#58;//tango-project.org/&quot;&amp;#62;Tango&amp;#160;Project&amp;#60;/a&amp;#62;&amp;#60;/div&amp;#62;&lt;br /&gt;
&lt;br /&gt;
&amp;#160;{if&amp;#160;$is_embedded&amp;#160;!=&amp;#160;true}&lt;br /&gt;
+&amp;#60;script&amp;#160;src=&quot;http&amp;#58;//www.google-analytics.com/urchin.js&quot;&lt;br /&gt;
+type=&quot;text/javascript&quot;&amp;#62;&lt;br /&gt;
+&amp;#60;/script&amp;#62;&lt;br /&gt;
+&amp;#60;script&amp;#160;type=&quot;text/javascript&quot;&amp;#62;&lt;br /&gt;
+_uacct&amp;#160;=&amp;#160;&quot;UA-669467-1&quot;;&lt;br /&gt;
+urchinTracker&amp;#40;&amp;#41;;&lt;br /&gt;
+&amp;#60;/script&amp;#62;&lt;br /&gt;
&amp;#160;&amp;#60;/body&amp;#62;&lt;br /&gt;
&amp;#160;&amp;#60;/html&amp;#62;&lt;br /&gt;
&amp;#160;{/if}&lt;/div&gt;&lt;/ol&gt;&lt;br /&gt;
&lt;br /&gt;
Now if all went well we should be able to run portupgrade on the installed port - or just run &#039;make install&#039; in the port directory if it&#039;s not installed yet - and the modifications to the index.tpl file should be made automatically.&lt;br /&gt;
&lt;br /&gt;
Admittedly this is a slightly complicated process and there are other easier ways of keeping a file after an upgrade - for example modify pkgtools.conf to make portupgrade execute commands after the port is installed to copy over the files you want updating.  However this method isn&#039;t as reliable as the patch file method.  If any changes are made to the files you&#039;re overwriting, portupgrade will never let you know about it - whereas with the patch file method, if one of the files you&#039;re wanting to modify has changed in the distribution tarball, then in all likelyhood the upgrade will fail becaue the patch process fails.  This allows you to look at the files that have changed in the distribution and change your patch file appropriately.&lt;br /&gt;
&lt;br /&gt;
 
    </content:encoded>

    <pubDate>Thu, 07 Sep 2006 01:29:28 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/178-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Google Sitemaps Generator Plugin</title>
    <link>http://freebsd.munk.me.uk/archives/174-Google-Sitemaps-Generator-Plugin.html</link>
            <category>Search Engines</category>
            <category>Serendipity</category>
    
    <comments>http://freebsd.munk.me.uk/archives/174-Google-Sitemaps-Generator-Plugin.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=174</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=174</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    Getting back into blogging again after a year or more break has been made a lot more interesting by the huge number of cool plugins that users are submitting to the &lt;a href=&quot;http://spartacus.s9y.org/&quot;  title=&quot;Serendipity Weblog Spartacus Plugin Site&quot;&gt;spartacus s9y plugin site&lt;/a&gt;.  Spartacus in itself needs a seperate blog entry really being the cool bundle of cool that it is!  Anyway for now this entry&#039;s about the &lt;a href=&quot;http://www.s9y.org/forums/viewtopic.php?t=1960&amp;highlight=sitemap+generator&quot;  title=&quot;Google Sitemap Generator&quot;&gt;Google Sitemap Generator Plugin&lt;/a&gt; (GSG).&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.google.com/support/webmasters/bin/answer.py?answer=40318&quot;  title=&quot;Google Sitemaps Explained&quot;&gt;Google Sitemaps are a way for webmasters to get their content indexed by Google more quickly and efficiently&lt;/a&gt;.  Using the &lt;a href=&quot;http://www.google.com/webmasters/sitemaps/protocol&quot;  title=&quot;Sitemap Protocol&quot;&gt;sitemap protocol&lt;/a&gt;, webmasters can outline what content is contained on their site and where Google can expect to find that content.  This way Google should be able to index a sitemapped website quicker.&lt;br /&gt;
&lt;br /&gt;
There are various ways to create a sitemap ranging from doing it by hand in a text editor or more easily by &lt;a href=&quot;http://www.google.com/support/webmasters/bin/answer.py?answer=34634&quot;  title=&quot;Google Sitemap Generator&quot;&gt;having the sitemap created automatically for you by a script&lt;/a&gt;.  Once the sitemap is ready it can be &lt;a href=&quot;http://www.google.com/support/webmasters/bin/answer.py?answer=34575&quot;  title=&quot;Adding a sitemap for a website&quot;&gt;submitted to Google online&lt;/a&gt; ready for Google to verify the sitemap and then crawl your site.&lt;br /&gt;
&lt;br /&gt;
All of this is good, except every time the site changes the sitemap becomes outdated.  However the Google Sitemap Generator plugin counters that problem.  The GSG plugin acts on the publish and save event hooks, so that any time you publish or save an article, the GSG plugin works in the background to create an updated map of all the published content on the site.  The plugin even &#039;pings&#039; Google to let it know that the sitemap has changed, making new content on your site get listed on Google quicker.  Ace!&lt;br /&gt;
&lt;br /&gt;
I&#039;d love to give credit to the author but all I know or can find out about him is his name is Boris.  Anway, thanks a load Boris :)&lt;br /&gt;
&lt;br /&gt;
EDIT: As I saved this entry the sitemap was generated successfully!:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;;&amp;#160;ls&amp;#160;-al&amp;#160;/web/freebsd.munk.me.uk/sitemap.xml.gz&lt;br /&gt;
-rw-r--r--&amp;#160;&amp;#160;1&amp;#160;www&amp;#160;&amp;#160;www&amp;#160;&amp;#160;40269&amp;#160;Sep&amp;#160;&amp;#160;3&amp;#160;15&amp;#58;53&amp;#160;/web/freebsd.munk.me.uk/sitemap.xml.gz&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;An important note&lt;/strong&gt; - you do still have to submit the sitemap manually for the first time - a note appears at the top of the s9y editing screen saying: If you have not submited your sitemap to google, do it now with visiting this link.  The &#039;link&#039; seems to be customized to submit the sitemap to google automatically... let&#039;s click it... ok yes it goes to the Google webmaster tools site where you have to submit the sitemap manually the first time.  All done!  Hopefully that&#039;ll make it easier for Google to spider the articles. 
    </content:encoded>

    <pubDate>Sun, 03 Sep 2006 14:29:25 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/174-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>
<item>
    <title>Serendipity Spam Statistics</title>
    <link>http://freebsd.munk.me.uk/archives/170-Serendipity-Spam-Statistics.html</link>
            <category>ipfilter</category>
            <category>Perl</category>
            <category>Serendipity</category>
            <category>Spam</category>
    
    <comments>http://freebsd.munk.me.uk/archives/170-Serendipity-Spam-Statistics.html#comments</comments>
    <wfw:comment>http://freebsd.munk.me.uk/wfwcomment.php?cid=170</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://freebsd.munk.me.uk/rss.php?version=2.0&amp;type=comments&amp;cid=170</wfw:commentRss>
    

    <author>nospam@example.com (munk)</author>
    <content:encoded>
    I just downloaded this great looking &lt;a href=&quot;andreas.id.au/blog/archives/77-Akismet-Spam-Statistics.html&quot;  title=&quot;Spam Statistics Plugin&quot;&gt;spam statistics plugin for Serendipity from Andreas&lt;/a&gt;.  Unfortunately after installing it it didn&#039;t seem to work, so I got stuck in to see what was up.&lt;br /&gt;
&lt;br /&gt;
Turns out it only works when the &lt;a href=&quot;http://blog.s9y.org/archives/123-Spamblock-Improvements,-Part-II.html&quot;  title=&quot;Serendipity Spamblock Plugin&quot;&gt;spamblock plugin&lt;/a&gt; logs to the database, so I&#039;ll either look into making it work with log files or maybe think about adding something to the admin stats plugin if that&#039;s possible.  Or do neither given it&#039;s not uber important to me given I get a raft of info on the spam stats each night via a cron job.&lt;br /&gt;
&lt;br /&gt;
I have a cron job that checks various things spam related on a daily basis - checking for referer spam, quarantined files uploaded via PHP, mod_security log entries that need attention and finally checking for serendipity / weblog spam.  The situation with weblog spam had gotten so bad on the old domain munk.nu that I even ended up creating a script to convert spamblock log entries into firewall rules for ipf.  I&#039;m not kidding, at least 100 trackback spam entries per day through June and July - for the year 2006 so far there are nearly 9000 unique IPs dropping new trackback spam.&lt;br /&gt;
&lt;br /&gt;
What&#039;s annoying too is that even adding offending IPs to my firewall block list, each and every new day there would be another 100 new unique IP addresses spamming the blog.  No doubt this is a botnet - 100 new zombies found per day sounds like a professional organisation.&lt;br /&gt;
&lt;br /&gt;
Ho hum.  Anyway I&#039;ll add the &#039;log2ipf.pl&#039; perl script in the extended part of this article.  It&#039;s a perl script that&#039;s little more than an extended &#039;grep | sed&#039; which searches for text in a file and then reports how many results it found for each item.  In the default case using just &#039;log2ipf.pl somefile.log&#039; it searches for:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&quot;s9y&quot;=&amp;#62;qr/.&amp;#42;\&amp;#91;REJECTED&amp;#58;&amp;#160;&amp;#91;No&amp;#160;API-created&amp;#160;comments|Trackback&amp;#160;URL&amp;#160;invalid|Filtered&amp;#160;by&amp;#160;Akismet\.com&amp;#93;.&amp;#42;,&amp;#160;IP&amp;#160;&amp;#40;.&amp;#42;?&amp;#41;&amp;#93;.&amp;#42;/,&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
in this case it reports a list of IP addresses and how many times each IP address was &#039;caught&#039; trying to spam - but it could be modified to do anything.  For example I have another &#039;filter&#039; setup to see how many people use a google search to find pics on my server by searching for the term &#039;picasa.ini&#039;:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;&quot;picasa&quot;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#62;qr/^.&amp;#42;?\s+&amp;#40;.&amp;#42;?&amp;#41;\s+.&amp;#42;%22index\+of%22\+%2F\+picasa\.ini.&amp;#42;/&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
so I can feed apache logfiles to log2ipf.pl using this commandline:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;;&amp;#160;log2ipf.pl&amp;#160;-l&amp;#160;picasa&amp;#160;/var/log/httpd/all/2006/07/&amp;#42;/&amp;#42;&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;24.242.97.20&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1&lt;br /&gt;
&amp;#160;&amp;#160;67.141.28.129&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
telling me there was just 2 such searches during July 2006 (woo).  I seem to remember that search returning more than that at the time I wrote the filter though lol.  You get the idea anyway.&lt;br /&gt;
&lt;br /&gt;
To add a new &#039;filter&#039;, best thing to do is import a sample logfile line you want to produce a result, then customize the script %re variable to include your custom filter.  &lt;br /&gt;
&lt;br /&gt;
For example, say you wanted to search for auth log failures for SSH (this is actually done for you by the periodic utility on FreeBSD if you set it up in /etc/periodic.conf, but that&#039;s another article! - you could write something like this for the %re filter:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;my&amp;#160;%re=&amp;#40;&lt;br /&gt;
&quot;s9y&quot;=&amp;#62;qr/.&amp;#42;\&amp;#91;REJECTED&amp;#58;&amp;#160;&amp;#91;No&amp;#160;API-created&amp;#160;comments|Trackback&amp;#160;URL&amp;#160;invalid|Filtered&amp;#160;by&amp;#160;Akismet\.com&amp;#93;.&amp;#42;,&amp;#160;IP&amp;#160;&amp;#40;.&amp;#42;?&amp;#41;&amp;#93;.&amp;#42;/,&lt;br /&gt;
#Example&amp;#160;of&amp;#160;logfile&amp;#160;line&amp;#160;we&amp;#160;want&amp;#160;to&amp;#160;catch&amp;#58;&lt;br /&gt;
#&amp;#160;Aug&amp;#160;26&amp;#160;14&amp;#58;57&amp;#58;35&amp;#160;users&amp;#160;sshd&amp;#91;30136&amp;#93;&amp;#58;&amp;#160;Failed&amp;#160;password&amp;#160;for&amp;#160;root&amp;#160;from&amp;#160;211.48.62.102&amp;#160;port&amp;#160;50706&amp;#160;ssh2&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&quot;ssh&quot;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#62;qr/.&amp;#42;Failed&amp;#160;password&amp;#160;for&amp;#160;.&amp;#42;&amp;#160;from&amp;#160;&amp;#40;.&amp;#42;?&amp;#41;&amp;#160;.&amp;#42;/,&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;&amp;#160;&quot;picasa&quot;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;=&amp;#62;qr/^.&amp;#42;?\s+&amp;#40;.&amp;#42;?&amp;#41;\s+.&amp;#42;%22index\+of%22\+%2F\+picasa\.ini.&amp;#42;/&lt;br /&gt;
&amp;#41;;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
which would result in:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;;&amp;#160;log2ipf.pl&amp;#160;-l&amp;#160;ssh&amp;#160;/var/log/auth.log&lt;br /&gt;
&amp;#160;168.126.71.148&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;1&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;210.34.14.53&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;3&lt;br /&gt;
&amp;#160;&amp;#160;84.10.149.105&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;3&lt;br /&gt;
&amp;#160;&amp;#160;211.48.62.102&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;3&lt;br /&gt;
&amp;#160;220.231.54.232&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;3&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;195.10.193.4&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;5&lt;br /&gt;
&amp;#160;213.179.181.26&amp;#58;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;11&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
As I say you can do the equivalent with grep, sed, sort and uniq on the commandline:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bb-code-title&quot;&gt;CODE:&lt;/div&gt;&lt;div class=&quot;bb-code&quot;&gt;;&amp;#160;grep&amp;#160;&quot;Failed&amp;#160;password&amp;#160;for&quot;&amp;#160;/var/log/auth.log&amp;#160;|&amp;#160;sed&amp;#160;-e&amp;#160;&#039;s/.&amp;#42;Failed&amp;#160;password&amp;#160;for&amp;#160;.&amp;#42;&amp;#160;from&amp;#160;\&amp;#40;&amp;#91;^&amp;#160;&amp;#93;&amp;#42;\&amp;#41;.&amp;#42;/\1/&#039;&amp;#160;\&lt;br /&gt;
&amp;#160;&amp;#160;|&amp;#160;sort&amp;#160;|&amp;#160;uniq&amp;#160;-c&amp;#160;|&amp;#160;sort&amp;#160;-n&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;1&amp;#160;168.126.71.148&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;3&amp;#160;210.34.14.53&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;3&amp;#160;211.48.62.102&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;3&amp;#160;220.231.54.232&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;3&amp;#160;84.10.149.105&lt;br /&gt;
&amp;#160;&amp;#160;&amp;#160;5&amp;#160;195.10.193.4&lt;br /&gt;
&amp;#160;&amp;#160;11&amp;#160;213.179.181.26&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
But for a very large file the timing differences between this method and the perl script are massive.&lt;br /&gt;
&lt;br /&gt;
Anyhoo this is turning into a crazy long entry so I&#039;ll turn it in.  The script log2ipf.pl - should rename that really since it&#039;s got little to do with ipf really! - is in the extended article below if anyone&#039;s interested.&lt;br /&gt;
 &lt;br /&gt;&lt;a href=&quot;http://freebsd.munk.me.uk/archives/170-Serendipity-Spam-Statistics.html#extended&quot;&gt;Continue reading &quot;Serendipity Spam Statistics&quot;&lt;/a&gt;
    </content:encoded>

    <pubDate>Thu, 31 Aug 2006 13:16:31 +0000</pubDate>
    <guid isPermaLink="false">http://freebsd.munk.me.uk/archives/170-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by/2.5/</creativeCommons:license>
</item>

</channel>
</rss>