public void map( LongWritable key, Text value, OutputCollector<Text, Text> output, Reporter reporter) throws IOException { String accessLine = value.toString(); AccessLogRecord record = new AccessLogRecord(accessLine); String request = record.getRequest(); String ipAddr = record.getIpAddr(); if (request != null && ipAddr != null) { int finalDotPos = ipAddr.lastIndexOf("."); if (finalDotPos != -1) { Text classC = new Text(ipAddr.substring(0, finalDotPos)); Text partD = new Text(ipAddr.substring(finalDotPos + 1)); for (String url : interesting_urls) { if (request.indexOf(url) >= 0) { // it's a hit! // split the ip addr so that the key gets A.B.C and value gets D. output.collect(classC, partD); } } } } }