Example input :
96.7.4.14 - - [24/Apr/2011:04:20:11 -0400] "GET /cat.jpg HTTP/1.1" 200 12433
String variable "ip" gives IP Address
96.7.4.14 - - [24/Apr/2011:04:20:11 -0400] "GET /cat.jpg HTTP/1.1" 200 12433
String[] fields = value.toString().split(" "); if (fields.length > 0) { String ip = fields[0]; }
No comments:
Post a Comment