logParser
Apache Log Parser written in Perl..
Used libraties:
File::Basename
;Geo::IPfree
;
These libraries can be easily installed using CPAN
.
# perl -MCPAN -e shell
cpan[1]> install File::Basename
cpan[2]> install Geo::IPfree
Log parser to group IP (IPv4) addresses with their total number of hits for each country IP address.
Output:
➜ logParser git:(master) ✗ time perl parser.pl
Total number of IP hits: 116815
Montenegro 30
Israel 229
Lebanon 70
Lithuania 61
Iran, Islamic Republic of 27
Philippines 462
Panama 34
Colombia 946
Hungary 162
Italy 2037
Slovenia 88
Algeria 83
Costa Rica 399
Slovakia 2
Bahrain 61
Indonesia 528
United States 61075
Albania 63
Argentina 1414
Canada 2456
Peru 388
Uruguay 3
Korea, Republic of 459
Malta 35
Mexico 866
Paraguay 27
Romania 731
Belarus 270
Macedonia, the Former Yugoslav Republic of 33
India 1521
Netherlands 1181
Luxembourg 32
Chile 468
Hong Kong 145
Cyprus 87
Norway 137
Bulgaria 97
Ukraine 97
Germany 3292
Sri Lanka 72
Switzerland 999
Saudi Arabia 59
Singapore 722
Myanmar 32
Ireland 357
China 1050
Venezuela, Bolivarian Republic of 121
Finland 454
Croatia 112
Japan 3661
United Kingdom 5906
New Zealand 177
Ecuador 166
Guatemala 30
Turkey 439
Oman 27
Australia 1476
Estonia 12
Belgium 1080
Denmark 497
Czech Republic 439
Spain 5272
Greece 937
Mozambique 20
Bolivia, Plurinational State of 38
Austria 320
Curacao 1
Bangladesh 351
Serbia 213
Pakistan 36
South Africa 259
Portugal 608
Brazil 1233
Maldives 63
Europe 125
France 6251
United Arab Emirates 64
Suriname 30
Poland 589
Bermuda 30
Malaysia 208
Kyrgyzstan 29
Thailand 97
Russian Federation 1147
Iceland 30
Taiwan, Province of China 68
Sweden 812
perl parser.pl 6.90s user 0.28s system 85% cpu 8.358 total