close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_core.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.
- Timestamp:
-
Aug 14, 2013, 10:10:10 PM (11 years ago)
- Author:
-
jazz
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
v1
|
v2
|
|
1 | 1 | = 2013-08-14 = |
2 | 2 | |
| 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 | }}} |
3 | 17 | {{{ |
4 | 18 | #!html |