Changes between Version 1 and Version 2 of jazz/13-08-14


Ignore:
Timestamp:
Aug 14, 2013, 10:10:10 PM (11 years ago)
Author:
jazz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • jazz/13-08-14

    v1 v2  
    11= 2013-08-14 =
    22
     3{{{
     4#!html
     5<br /> register /home/dvryaboy/src/pig/trunk/piggybank.jar;<br /> DEFINE LogLoader<br /> org.apache.pig.piggybank.storage.apachelog.CombinedLogLoader();<br /> DEFINE DayExtractor<br /> org.apache.pig.piggybank.evaluation.util.apachelogparser.DateExtractor('yyyy-MM-dd');<br />
     6}}}
     7{{{
     8#!html
     9<br /> %default LOGS 'access_log.small'<br /> %default GEO 'GeoLiteCity.dat'<br />
     10}}}
     11{{{
     12#!html
     13<br /> #!/usr/bin/env perl<br /> use warnings;<br /> use strict;<br /> use Geo::IP::PurePerl;</p>
     14<p>my ($path)=shift;<br /> my $gi = Geo::IP::PurePerl->new($path);</p>
     15<p>while (<>) {<br /> chomp;<br /> if (/([^\t]*)\t(.*)/) {<br /> my ($ip, $rest) = ($1, $2);<br /> my ($country_code, undef, $country_name, $region, $city)<br /> = $gi->get_city_record($ip);<br /> print join("\t", $country_code||'', $country_name||'',<br /> $region||'', $city||'', $ip, $rest), "\n";<br /> }<br /> }<br />
     16}}}
    317{{{
    418#!html