I am able to parse the mlab ndt trace log files using the PcapFileInputFormat using the GitHub code located at url https://github.com/raghuveerm/MRPcapParser. I'm able to parse the fields(like TIMESTAMP) which are predefined in the "Packet.java" class.But I'm unable to add the new fields like(total_traffic,Total_Size) and parse them .Eventhough I had included the new fields in Packet.java and tried to debug the code.The debugger is not entering into the code where I had newly edited with the new fields.
My Edited Code:
===============
In PacketReader.java:(In hadoop-pcap-lib)
====================
(src-->main-->java-->net-->ripe-->hadoop-->pcap-->PcapReader.java)
At Line 62: public static final int TOTAL_SIZE_OFFSET = 12;
At Line 162:
long totalSize = PcapReaderUtil.convertInt(pcapPacketHeader, TOTAL_SIZE_OFFSET, reverseHeaderByteOrder);
packet.put(Packet.TOTAL_SIZE, totalSize);
In Packet.java:(In hadoop-pcap-lib)
==============
(src-->main-->java-->net-->ripe-->hadoop-->pcap-->packet-->Packet.java)
At Line 36: public static final String TOTAL_SIZE = "tot_size";
My Mapper:
=========
package com.calsoftlabs.parse;
import net.ripe.hadoop.pcap.packet.Packet;
public class PcapMapper extends Mapper<LongWritable, ObjectWritable, Text, Text> {
public void map(LongWritable arg0, ObjectWritable arg1, Context context) throws IOException,
InterruptedException {
Packet packet = (Packet) arg1.get();
String clientIp = null;
String serverIp = null;
String timeStamp = null;
String totalTraffic = null;
String srcPort = null;
String destPort = null;
String fields = null;
if (packet != null) {
clientIp = packet.get(Packet.SRC).toString();
srcPort = packet.get(Packet.SRC_PORT).toString();
serverIp = packet.get(Packet.DST).toString();
destPort = packet.get(Packet.DST_PORT).toString();
timeStamp = packet.get(Packet.TIMESTAMP).toString();
totalTraffic = packet.get(Packet.TOTAL_SIZE).toString();
if (serverIp != null && srcPort != null && destPort != null ) {
fields = serverIp
.concat(", ").concat(srcPort)
.concat(", ").concat(destPort);
.concat(", ").concat(totalTraffic);
}
}
context.write(new Text(clientIp.concat("_").concat(timeStamp).concat("::")), new Text(fields));
}
}
Finally,If I run a MRJob I'm getting a null pointer exception near total_traffic.Because the debugger is not at all entering into the newly edited code.How can I overcome this issue.Can anyone please suggest on this issue ...
Thanks,in advance