<?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/"
   >
<channel>
    <title>Simone 'Wiz' Tellini (Entries tagged as logminer)</title>
    <link>http://tellini.info/blog/</link>
    <description>To strive, to seek, to find, and not to yield.</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.1 - http://www.s9y.org/</generator>
    <pubDate>Tue, 30 Jun 2009 17:54:45 GMT</pubDate>

    <image>
        <url>http://tellini.info/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Simone 'Wiz' Tellini - To strive, to seek, to find, and not to yield.</title>
        <link>http://tellini.info/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>LogMiner 1.23</title>
    <link>http://tellini.info/blog/archives/88-LogMiner-1.23.html</link>
            <category>Software</category>
            <category>SysAdmin</category>
    
    <comments>http://tellini.info/blog/archives/88-LogMiner-1.23.html#comments</comments>
    <wfw:comment>http://tellini.info/blog/wfwcomment.php?cid=88</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://tellini.info/blog/rss.php?version=2.0&amp;type=comments&amp;cid=88</wfw:commentRss>
    

    <author>nospam@example.com (Simone)</author>
    <content:encoded>
    Version 1.23 of &lt;a href=&quot;http://logminer.sourceforge.net/&quot;  title=&quot;LogMiner at SourceForge&quot;&gt;LogMiner&lt;/a&gt;, my Apache/IIS log analysis package, is now available.&lt;br /&gt;
&lt;br /&gt;
This release mainly fixes some build problem on modern distributions.&lt;br /&gt;
&lt;br /&gt;
Also it finally includes the &lt;a href=&quot;http://tellini.info/blog/archives/48-LogMiner-purging-old-accesses.html&quot;&gt;cleanup function&lt;/a&gt; I was talking about &lt;em&gt;some&lt;/em&gt; days ago... 
    </content:encoded>

    <pubDate>Tue, 30 Jun 2009 10:42:32 -0700</pubDate>
    <guid isPermaLink="false">http://tellini.info/blog/archives/88-guid.html</guid>
    <category>analysis</category>
<category>apache</category>
<category>iis</category>
<category>logminer</category>
<category>logs</category>
<category>software</category>
<category>sysadmin</category>

</item>
<item>
    <title>Who's linking to your site?</title>
    <link>http://tellini.info/blog/archives/64-Whos-linking-to-your-site.html</link>
            <category>SysAdmin</category>
    
    <comments>http://tellini.info/blog/archives/64-Whos-linking-to-your-site.html#comments</comments>
    <wfw:comment>http://tellini.info/blog/wfwcomment.php?cid=64</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://tellini.info/blog/rss.php?version=2.0&amp;type=comments&amp;cid=64</wfw:commentRss>
    

    <author>nospam@example.com (Simone)</author>
    <content:encoded>
    If you&#039;re using &lt;a href=&quot;http://logminer.tellini.info/&quot;&gt;LogMiner&lt;/a&gt; to analyse your Apache/IIS logs, here&#039;s an easy recipe to be notified of sites that send visitors your way.&lt;br /&gt;
&lt;br /&gt;
First, let&#039;s define a Pg/PLSQL function to extract the new referrers:&lt;br /&gt;
&lt;div class=&quot;sql geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; TYPE new_referrer &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; site_id &amp;#160; &amp;#160; &amp;#160; &amp;#160; int8&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; site_name &amp;#160; &amp;#160; &amp;#160; text&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; referrer &amp;#160; &amp;#160; &amp;#160; &amp;#160;text&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; hits &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;int&lt;br /&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;REPLACE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FUNCTION&lt;/span&gt; get_new_referrers&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;RETURNS SETOF new_referrer &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; $body$&lt;br /&gt;&amp;#160; &amp;#160; DECLARE&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; rec &amp;#160; &amp;#160; &amp;#160; &amp;#160; new_referrer;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; lastRef &amp;#160; &amp;#160; int8;&lt;br /&gt;&amp;#160; &amp;#160; BEGIN&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;INTO&lt;/span&gt; lastRef CAST&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; value &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; int8 &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; catalog&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; name &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;LastReferrer&#039;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IF&lt;/span&gt; lastRef &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NULL&lt;/span&gt; THEN&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;INSERT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;INTO&lt;/span&gt; catalog &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; name&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; value &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;VALUES&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;LastReferrer&#039;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; lastRef :&lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; END &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IF&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FOR&lt;/span&gt; rec &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IN&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; EXECUTE &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;SELECT s.id AS site_id, s.name AS site_name, r.referrer, tmp.hits &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;FROM ( &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039; &amp;#160; SELECT site, referrer, COUNT(*) AS hits &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039; &amp;#160; FROM accesses &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039; &amp;#160; WHERE referrer &amp;gt; &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt; lastRef &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039; &amp;#160; GROUP BY site, referrer &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;) tmp &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;JOIN sites s ON s.id = tmp.site &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;JOIN referrers r ON tmp.referrer = r.id &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;WHERE r.extern = true &#039;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;||&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;ORDER BY s.name, tmp.hits DESC, r.referrer&#039;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; LOOP&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;RETURN&lt;/span&gt; NEXT rec;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; END LOOP;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;UPDATE&lt;/span&gt; catalog&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SET&lt;/span&gt; value &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; MAX&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; referrers &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; name &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;LastReferrer&#039;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;RETURN&lt;/span&gt;;&lt;br /&gt;&amp;#160; &amp;#160; END;&lt;br /&gt;$body$ &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;LANGUAGE&lt;/span&gt; plpgsql;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Then, a little PHP script to run the query and format the results:&lt;br /&gt;
&lt;div class=&quot;php geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;#!/usr/local/bin/php&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;?php&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$lines&lt;/span&gt; &amp;#160; &amp;#160;&lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$lastSite&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;&#039;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;// quickest and dirtiest way to execute a query in PHP ;-)&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a href=&quot;http://www.php.net/exec&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;exec&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;echo &#039;SELECT r.* &amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;FROM get_new_referrers() r &amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;LEFT JOIN search_engines se ON ( r.referrer ~* se.pattern AND r.referrer ~* se.query_pattern )&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;WHERE se.id IS NULL&#039; | /usr/local/pgsql/bin/psql -U logminer -At logminer&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$lines&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;foreach&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$lines&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$line&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$parts&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;a href=&quot;http://www.php.net/explode&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;explode&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&#039;|&#039;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$line&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;4&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #b1b100;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$lastSite&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;!=&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$parts&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a href=&quot;http://www.php.net/printf&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;printf&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;-------------------------------------------------------&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;Referrers for &lt;span style=&quot;color: #009933; font-weight: bold;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;.&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;-------------------------------------------------------&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$parts&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000088;&quot;&gt;$lastSite&lt;/span&gt; &lt;span style=&quot;color: #339933;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$parts&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;a href=&quot;http://www.php.net/printf&quot;&gt;&lt;span style=&quot;color: #990000;&quot;&gt;printf&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;&amp;quot;[&lt;span style=&quot;color: #009933; font-weight: bold;&quot;&gt;%d&lt;/span&gt;] &lt;span style=&quot;color: #009933; font-weight: bold;&quot;&gt;%s&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$parts&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #000088;&quot;&gt;$parts&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #339933;&quot;&gt;;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #009900;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
The query above grabs the referrers for every site available in the DB, filtering requests coming from known search engines to reduce the level of &quot;noise&quot;.&lt;br /&gt;
&lt;br /&gt;
This script is finally invoked by the cron job that processes the logs:&lt;br /&gt;
&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;referrers_report.php &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; mail &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;New referrers report&#039;&lt;/span&gt; email&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;@&lt;/span&gt;example.com&lt;br /&gt;&amp;#160;&lt;/div&gt; 
    </content:encoded>

    <pubDate>Fri, 20 Jun 2008 14:57:28 -0700</pubDate>
    <guid isPermaLink="false">http://tellini.info/blog/archives/64-guid.html</guid>
    <category>apache</category>
<category>iis</category>
<category>logminer</category>
<category>logs</category>
<category>referrers</category>
<category>sysadmin</category>

</item>
<item>
    <title>How much would it cost to rewrite it?</title>
    <link>http://tellini.info/blog/archives/60-How-much-would-it-cost-to-rewrite-it.html</link>
            <category>Software</category>
            <category>Software Development</category>
    
    <comments>http://tellini.info/blog/archives/60-How-much-would-it-cost-to-rewrite-it.html#comments</comments>
    <wfw:comment>http://tellini.info/blog/wfwcomment.php?cid=60</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://tellini.info/blog/rss.php?version=2.0&amp;type=comments&amp;cid=60</wfw:commentRss>
    

    <author>nospam@example.com (Simone)</author>
    <content:encoded>
    I&#039;ve just added &lt;a href=&quot;http://logminer.tellini.info/&quot;&gt;LogMiner&lt;/a&gt; to &lt;a href=&quot;http://www.ohloh.net/projects/logminer&quot;&gt;Ohloh&lt;/a&gt;, a site that offers an interesting feature: it can analyse a project source code and estimate how much it would cost to hire a development team to recreate the project from scratch.&lt;br /&gt;
&lt;br /&gt;
I think that it&#039;s a simple way to estimate the effort you put over the time in open source projects.&lt;br /&gt;
&lt;br /&gt;
Here&#039;s the resulting figure for LogMiner:&lt;br /&gt;
&lt;div align=&quot;center&quot; style=&quot;border-style: none&quot;&gt;&lt;br /&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://www.ohloh.net/projects/14626/widgets/project_partner_badge&quot;&gt;&lt;/script&gt;&lt;br /&gt;
&lt;/div&gt; 
    </content:encoded>

    <pubDate>Mon, 02 Jun 2008 17:13:44 -0700</pubDate>
    <guid isPermaLink="false">http://tellini.info/blog/archives/60-guid.html</guid>
    <category>logminer</category>
<category>software</category>
<category>software development</category>

</item>
<item>
    <title>LogMiner: purging old accesses</title>
    <link>http://tellini.info/blog/archives/48-LogMiner-purging-old-accesses.html</link>
            <category>SysAdmin</category>
    
    <comments>http://tellini.info/blog/archives/48-LogMiner-purging-old-accesses.html#comments</comments>
    <wfw:comment>http://tellini.info/blog/wfwcomment.php?cid=48</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://tellini.info/blog/rss.php?version=2.0&amp;type=comments&amp;cid=48</wfw:commentRss>
    

    <author>nospam@example.com (Simone)</author>
    <content:encoded>
    I&#039;ve just committed a function to easily purge old data from LogMiner&#039;s database, useful to prevent it from growing too much.&lt;br /&gt;
&lt;br /&gt;
It&#039;ll appear in the next version, but since its release might still be far from now, here&#039;s the code for those who need it:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;sql geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;REPLACE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FUNCTION&lt;/span&gt; cleanup&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; _site int8&lt;span style=&quot;color: #66cc66;&quot;&gt;,&lt;/span&gt; _upToDate date &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;br /&gt;RETURNS INT &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AS&lt;/span&gt; $body$&lt;br /&gt;&amp;#160; &amp;#160; BEGIN&lt;br /&gt;&amp;#160; &amp;#160; &lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DELETE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; accesses&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; req_time &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;lt;&lt;/span&gt; _upToDate&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;AND&lt;/span&gt; site &lt;span style=&quot;color: #66cc66;&quot;&gt;=&lt;/span&gt; _site;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ALTER&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; accesses &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DROP&lt;/span&gt; CONSTRAINT accesses_request_fkey;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ALTER&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; accesses &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DROP&lt;/span&gt; CONSTRAINT accesses_search_fkey;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ALTER&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; accesses &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DROP&lt;/span&gt; CONSTRAINT accesses_referrer_fkey;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DELETE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; requests&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IN&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DISTINCT&lt;/span&gt; request &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; accesses &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DELETE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; search_referrals&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IN&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DISTINCT&lt;/span&gt; search &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; accesses &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DELETE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; referrers&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;WHERE&lt;/span&gt; id &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;IN&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SELECT&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DISTINCT&lt;/span&gt; referrer &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FROM&lt;/span&gt; accesses &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ALTER&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; accesses&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ADD&lt;/span&gt; CONSTRAINT &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;accesses_request_fkey&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FOREIGN&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;KEY&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; request &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;REFERENCES&lt;/span&gt; requests&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ON&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DELETE&lt;/span&gt; CASCADE;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ALTER&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; accesses&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ADD&lt;/span&gt; CONSTRAINT &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;accesses_search_fkey&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FOREIGN&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;KEY&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; search &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;REFERENCES&lt;/span&gt; search_referrals&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ON&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DELETE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SET&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ALTER&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;TABLE&lt;/span&gt; accesses&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ADD&lt;/span&gt; CONSTRAINT &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;accesses_referrer_fkey&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;FOREIGN&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;KEY&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; referrer &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;REFERENCES&lt;/span&gt; referrers&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; id &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;ON&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;DELETE&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;SET&lt;/span&gt; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;RETURN&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;;&lt;br /&gt;&amp;#160; &amp;#160; END;&lt;br /&gt;$body$ &lt;span style=&quot;color: #993333; font-weight: bold;&quot;&gt;LANGUAGE&lt;/span&gt; plpgsql;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
For instance, if you want to keep only the last six month of data, you can set up a cron job which runs at the first day of every month executing the command:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# supposing 1 is the id of your site&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;SELECT * FROM cleanup( 1, CAST( date_trunc( &#039;month&#039;, now() ) - interval &#039;5 months&#039; AS date ));&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;|&lt;/span&gt; psql &lt;span style=&quot;color: #660033;&quot;&gt;-U&lt;/span&gt; logminer logminer&lt;/div&gt; 
    </content:encoded>

    <pubDate>Sat, 26 Jan 2008 18:53:22 -0800</pubDate>
    <guid isPermaLink="false">http://tellini.info/blog/archives/48-guid.html</guid>
    <category>logminer</category>
<category>sysadmin</category>

</item>
<item>
    <title>Mac OS X version statistics through CFNetwork analysis</title>
    <link>http://tellini.info/blog/archives/39-Mac-OS-X-version-statistics-through-CFNetwork-analysis.html</link>
            <category>SysAdmin</category>
    
    <comments>http://tellini.info/blog/archives/39-Mac-OS-X-version-statistics-through-CFNetwork-analysis.html#comments</comments>
    <wfw:comment>http://tellini.info/blog/wfwcomment.php?cid=39</wfw:comment>

    <slash:comments>4</slash:comments>
    <wfw:commentRss>http://tellini.info/blog/rss.php?version=2.0&amp;type=comments&amp;cid=39</wfw:commentRss>
    

    <author>nospam@example.com (Simone)</author>
    <content:encoded>
    Recently I needed to gather some statistics about the distribution of the different Mac OS X versions installed by users of a certain application.&lt;br /&gt;
&lt;br /&gt;
Since the application has an update-check feature, I thought I&#039;d use the web server logs to infer the data I was interested in. The only thing I could use was the &lt;strong&gt;User-Agent&lt;/strong&gt; string sent by the application when requesting the file containing the update information.&lt;br /&gt;
&lt;br /&gt;
After some digging in Darwin&#039;s build plists and a bit of googling, I came up with this list of patterns:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;br /&gt;
            OS            |                user agent pattern&lt;br /&gt;
--------------------------+---------------------------------------------------&lt;br /&gt;
 Mac OS X 10.2            | ^CFNetwork/1\.1$&lt;br /&gt;
 Mac OS X 10.3.2-10.3.8   | ^CFNetwork/1\.2\.1$&lt;br /&gt;
 Mac OS X 10.3.9          | ^CFNetwork/1\.2\.[2-6]$&lt;br /&gt;
 Mac OS X 10.4            | ^CFNetwork/128$&lt;br /&gt;
 Mac OS X 10.4.10         | ^CFNetwork/129\.21$&lt;br /&gt;
 Mac OS X 10.4.11         | ^CFNetwork/129\.22$&lt;br /&gt;
 Mac OS X 10.4.2          | ^CFNetwork/128\.2$&lt;br /&gt;
 Mac OS X 10.4.3          | ^CFNetwork/(129\.5|10\.4\.3)$&lt;br /&gt;
 Mac OS X 10.4.4          | ^CFNetwork/(129\.(9|10)|10\.4\.4)$&lt;br /&gt;
 Mac OS X 10.4.5          | ^CFNetwork/129\.11$&lt;br /&gt;
 Mac OS X 10.4.6          | ^CFNetwork/129\.13$&lt;br /&gt;
 Mac OS X 10.4.7          | ^CFNetwork/(129\.16|4\.0)$&lt;br /&gt;
 Mac OS X 10.4.8          | ^CFNetwork/129\.1(8|9)$&lt;br /&gt;
 Mac OS X 10.4.9          | ^CFNetwork/129\.20$&lt;br /&gt;
 Mac OS X 10.5            | ^CFNetwork/21[7-9]$&lt;br /&gt;
 Mac OS X 10.5.1          | ^CFNetwork/220$&lt;br /&gt;
 Mac OS X 10.5-prerelease | ^CFNetwork/1[4-9][0-9](\.[0-9])?|20[0-9]|21[0-9]$&lt;br /&gt;
&lt;/pre&gt;&lt;br /&gt;
They might not be 100% correct, but they&#039;re good enough. 
    </content:encoded>

    <pubDate>Fri, 07 Dec 2007 12:05:00 -0800</pubDate>
    <guid isPermaLink="false">http://tellini.info/blog/archives/39-guid.html</guid>
    <category>analysis</category>
<category>logminer</category>
<category>logs</category>
<category>sysadmin</category>

</item>
<item>
    <title>LogMiner 1.21</title>
    <link>http://tellini.info/blog/archives/38-LogMiner-1.21.html</link>
            <category>Software</category>
    
    <comments>http://tellini.info/blog/archives/38-LogMiner-1.21.html#comments</comments>
    <wfw:comment>http://tellini.info/blog/wfwcomment.php?cid=38</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://tellini.info/blog/rss.php?version=2.0&amp;type=comments&amp;cid=38</wfw:commentRss>
    

    <author>nospam@example.com (Simone)</author>
    <content:encoded>
    Version 1.21 of &lt;a href=&quot;http://logminer.sourceforge.net/&quot;  title=&quot;LogMiner at SourceForge&quot;&gt;LogMiner&lt;/a&gt;, my Apache/IIS log analysis package, is now available.&lt;br /&gt;
&lt;br /&gt;
This release sports a new report: Networks.&lt;br /&gt;
&lt;br /&gt;
It allows you to monitor where your visitor come from, in terms of organization and network. To use this report, you need to define a list of organizations and a list of networks owned by them.&lt;br /&gt;
&lt;br /&gt;
For instance, if you wish to check how many hits you get from Google&#039;s crawlers, you can define a &lt;strong&gt;Crawler&lt;/strong&gt; network owned by &lt;strong&gt;Google&lt;/strong&gt; with the address &lt;strong&gt;66.249.64.0/19&lt;/strong&gt; (this is just an example and may not be entirely correct, although my logs always show GoogleBot coming from that IP range). 
    </content:encoded>

    <pubDate>Sat, 03 Nov 2007 13:26:58 -0700</pubDate>
    <guid isPermaLink="false">http://tellini.info/blog/archives/38-guid.html</guid>
    <category>analysis</category>
<category>apache</category>
<category>logminer</category>
<category>logs</category>
<category>open source</category>
<category>software</category>

</item>
<item>
    <title>LogMiner 1.20</title>
    <link>http://tellini.info/blog/archives/34-LogMiner-1.20.html</link>
            <category>Software</category>
    
    <comments>http://tellini.info/blog/archives/34-LogMiner-1.20.html#comments</comments>
    <wfw:comment>http://tellini.info/blog/wfwcomment.php?cid=34</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://tellini.info/blog/rss.php?version=2.0&amp;type=comments&amp;cid=34</wfw:commentRss>
    

    <author>nospam@example.com (Simone)</author>
    <content:encoded>
    Version 1.20 of &lt;a href=&quot;http://logminer.sourceforge.net/&quot;  title=&quot;LogMiner at SourceForge&quot;&gt;LogMiner&lt;/a&gt;, my Apache/IIS log analysis package, is now available.&lt;br /&gt;
&lt;br /&gt;
This version doesn&#039;t require anymore libpqxx 2.5.5: it compiles as well with version 2.6.9 (I don&#039;t understand why they had to remove a couple of really useful functions in the 2.6.x series, though).&lt;br /&gt;
&lt;br /&gt;
The other most important change is that in case of SQL errors while inserting data into the DB, LogMiner won&#039;t abort the parsing of the log. Instead, it will record the error and skip the log line that caused the problem. This fix has actually been inspired by lame spammers who keep on trying to exploit the contact page on this site; too bad that they didn&#039;t study HTTP well enough: the content of a POST request follows the headers, it doesn&#039;t precede the method. &lt;img src=&quot;http://tellini.info/blog/templates/default/img/emoticons/wink.png&quot; alt=&quot;;-)&quot; style=&quot;display: inline; vertical-align: bottom;&quot; class=&quot;emoticon&quot; /&gt; They were causing LogMiner to try to fit the spam body into the varchar(32) method column. 
    </content:encoded>

    <pubDate>Fri, 10 Aug 2007 14:25:00 -0700</pubDate>
    <guid isPermaLink="false">http://tellini.info/blog/archives/34-guid.html</guid>
    <category>analysis</category>
<category>apache</category>
<category>iis</category>
<category>logminer</category>
<category>logs</category>
<category>software</category>

</item>

</channel>
</rss>