<?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 - SysAdmin</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.3 - http://www.s9y.org/</generator>
    <pubDate>Fri, 20 Jun 2008 22:34:27 GMT</pubDate>

    <image>
        <url>http://tellini.info/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: Simone 'Wiz' Tellini - SysAdmin - 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>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&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; &amp;#160;int8,&lt;br /&gt;&amp;#160; &amp;#160; site_name&amp;#160; &amp;#160; &amp;#160; &amp;#160;text,&lt;br /&gt;&amp;#160; &amp;#160; referrer&amp;#160; &amp;#160; &amp;#160; &amp;#160; text,&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; &amp;#160;new_referrer;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; lastRef&amp;#160; &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: #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, 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: #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: #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;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;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; &amp;#160;SELECT site, referrer, COUNT(*) AS hits &#039;&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; &amp;#160;FROM accesses &#039;&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; &amp;#160;WHERE referrer &amp;gt; &#039;&lt;/span&gt; || lastRef ||&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; &amp;#160;GROUP BY site, referrer &#039;&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;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;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;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;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;&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: #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&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;#!/usr/local/bin/php&lt;/span&gt;&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: #0000ff;&quot;&gt;$lines&lt;/span&gt;&amp;#160; &amp;#160; = &lt;a href=&quot;http://www.php.net/array&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;array&lt;/span&gt;&lt;/a&gt;&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;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$lastSite&lt;/span&gt; = &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;&#039;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #808080; 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: #000066;&quot;&gt;exec&lt;/span&gt;&lt;/a&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;echo &#039;SELECT r.* &quot;&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;&quot;FROM get_new_referrers() r &quot;&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;&quot;LEFT JOIN search_engines se ON ( r.referrer ~* se.pattern AND r.referrer ~* se.query_pattern )&quot;&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;&quot;WHERE se.id IS NULL&#039; | /usr/local/pgsql/bin/psql -U logminer -At logminer&quot;&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: #0000ff;&quot;&gt;$lines&lt;/span&gt; &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: #b1b100;&quot;&gt;foreach&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$lines&lt;/span&gt; &lt;span style=&quot;color: #b1b100;&quot;&gt;as&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$line&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #0000ff;&quot;&gt;$parts&lt;/span&gt; = &lt;a href=&quot;http://www.php.net/explode&quot;&gt;&lt;span style=&quot;color: #000066;&quot;&gt;explode&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;|&#039;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$line&lt;/span&gt;, &lt;span style=&quot;color: #cc66cc;&quot;&gt;4&lt;/span&gt; &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; &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: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #0000ff;&quot;&gt;$lastSite&lt;/span&gt; != &lt;span style=&quot;color: #0000ff;&quot;&gt;$parts&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&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: #000066;&quot;&gt;printf&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&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;&quot;&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: #ff0000;&quot;&gt;&quot;-------------------------------------------------------&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&quot;&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: #ff0000;&quot;&gt;&quot;Referrers for %s&lt;span style=&quot;color: #000099; font-weight: bold;&quot;&gt;\n&lt;/span&gt;&quot;&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: #ff0000;&quot;&gt;&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;&quot;&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;$parts&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt; &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; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #0000ff;&quot;&gt;$lastSite&lt;/span&gt; = &lt;span style=&quot;color: #0000ff;&quot;&gt;$parts&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&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: #66cc66;&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: #000066;&quot;&gt;printf&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;[%d] %s&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;&quot;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$parts&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&lt;/span&gt;, &lt;span style=&quot;color: #0000ff;&quot;&gt;$parts&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #cc66cc;&quot;&gt;2&lt;/span&gt; &lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#93;&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; &lt;span style=&quot;color: #66cc66;&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&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;referrers_report.php | mail -s &lt;span style=&quot;color: #ff0000;&quot;&gt;&#039;New referrers report&#039;&lt;/span&gt; email@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>lm_sensors config for Asus T3-P5945GCX (P5L13L motherboard)</title>
    <link>http://tellini.info/blog/archives/52-lm_sensors-config-for-Asus-T3-P5945GCX-P5L13L-motherboard.html</link>
            <category>SysAdmin</category>
    
    <comments>http://tellini.info/blog/archives/52-lm_sensors-config-for-Asus-T3-P5945GCX-P5L13L-motherboard.html#comments</comments>
    <wfw:comment>http://tellini.info/blog/wfwcomment.php?cid=52</wfw:comment>

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

    <author>nospam@example.com (Simone)</author>
    <content:encoded>
    I&#039;ve just installed the latest Mandriva 2008.1 RC on this fine Asus barebone.&lt;br /&gt;
&lt;br /&gt;
Everything went fine, except that the output of sensors showed too many ALARM messages for my taste... so, here&#039;s how I&#039;ve modified the pre-installed &lt;strong&gt;sensors.conf&lt;/strong&gt; to set some min/max values closer to reality and to hide useless lines:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;bash&quot; style=&quot;text-align: left&quot;&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Winbond W83627EHF configuration originally contributed by Leon Moonen&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# This is for an Asus P5P800, voltages for A8V-E SE.&lt;/span&gt;&lt;br /&gt;chip &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;w83627ehf-*&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;w83627dhg-*&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; label in0 &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;VCore&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; label in2 &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;AVCC&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; label in3 &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;3VCC&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; label in7 &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;VSB&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; label in8 &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;VBAT&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# +12V is in1 and +5V is in6 as recommended by datasheet&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; compute in1 @*&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;+&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;56&lt;/span&gt;/&lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;,&amp;#160; @/&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;+&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;56&lt;/span&gt;/&lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; compute in6 @*&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;+&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;22&lt;/span&gt;/&lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;,&amp;#160; @/&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;+&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #cc66cc;&quot;&gt;22&lt;/span&gt;/&lt;span style=&quot;color: #cc66cc;&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #66cc66;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in1_min&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;12&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;9&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in1_max&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;12&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in6_min&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;5&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;95&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in6_max&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;5&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;05&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in4_min&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;6&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;9&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in4_max&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;6&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;05&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in9_min&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;6&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;9&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in9_max&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;6&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;05&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Set the 3.3V&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in2_min&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;95&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in2_max&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;05&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in3_min&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;95&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in3_max&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;05&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in7_min&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;95&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in7_max&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;05&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in8_min&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;0&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;95&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; in8_max&amp;#160; &amp;#160;&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;3&lt;/span&gt;*&lt;span style=&quot;color: #cc66cc;&quot;&gt;1&lt;/span&gt;.&lt;span style=&quot;color: #cc66cc;&quot;&gt;05&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Fans&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160;label fan2&amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;CPU Fan&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; ignore fan1&lt;br /&gt;&amp;#160; ignore fan3&lt;br /&gt;&amp;#160; ignore fan4&lt;br /&gt;&amp;#160; ignore fan5&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# Temperatures&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160;label temp1&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;Sys Temp&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160;label temp2&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;CPU Temp&quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160;label temp3&amp;#160; &amp;#160; &amp;#160;&lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;AUX Temp&quot;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; temp1_over&amp;#160; &lt;span style=&quot;color: #cc66cc;&quot;&gt;45&lt;/span&gt;&lt;br /&gt;&amp;#160; &lt;span style=&quot;color: #000066;&quot;&gt;set&lt;/span&gt; temp1_hyst&amp;#160; &lt;span style=&quot;color: #cc66cc;&quot;&gt;40&lt;/span&gt;&lt;br /&gt;&amp;#160;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Corrections are welcome. 
    </content:encoded>

    <pubDate>Sat, 08 Mar 2008 11:24:00 -0800</pubDate>
    <guid isPermaLink="false">http://tellini.info/blog/archives/52-guid.html</guid>
    <category>asus</category>
<category>linux</category>
<category>lm_sensors</category>
<category>mandriva</category>
<category>sysadmin</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&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, _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 &amp;lt; _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 = _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;&quot;accesses_request_fkey&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;&quot;accesses_search_fkey&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;&quot;accesses_referrer_fkey&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&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #808080; font-style: italic;&quot;&gt;# supposing 1 is the id of your site&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #000066;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&quot;SELECT * FROM cleanup( 1, CAST( date_trunc( &#039;month&#039;, now() ) - interval &#039;5 months&#039; AS date ));&quot;&lt;/span&gt; | psql -U 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>0</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>

</channel>
</rss>