So I am using the JSON utility to parse some data from my server, and it works for all my fields really well except for one. The field is called “@timestamp” and it is relatively important for what I am trying to do.
Here is some example output:
"hits" : [
{
"_index" : "packetbeat-2017.03.01",
"_type" : "flow",
"_id" : "AVqKz-18tMLfAv1xdACp",
"_score" : null,
"_source" : {
"@timestamp" : "2017-03-01T16:59:25.303Z",
"transport" : "tcp",
"dest" : {
"port" : 5432,
"stats" : {
"net_bytes_total" : 204270,
"net_packets_total" : 193
},
"ip" : "192.168.203.45",
"mac" : "00:16:47:9d:f2:c4"
},
"packet_source" : {
"port" : 34459,
"stats" : {
"net_bytes_total" : 16030,
"net_packets_total" : 165
},
"ip" : "192.168.204.45",
"mac" : "aa:00:04:00:0a:04"
},
"tags" : [
"beats_input_raw_event"
]
},
"sort" : [
1488387565303
]
}
]
And here is my C# class that is being used for the JSON Utility:
[System.Serializable]
public class HitsData_Packet
{
public string _id;
//public string @timestamp;
public Source_Packet _source;
}
// This is really the information that I care about right now
[System.Serializable]
public class Source_Packet
{
// Packetbeat stuff
public string @timestamp;
public string transport;
public DestinationData_Packetbeat dest;
public SourceData_Packetbeat packet_source;
public string service;
public string proto;
public int sourceIpInt;
public int destIpInt;
}
[System.Serializable]
public class SourceData_Packetbeat
{
public int port;
public string ip;
public string mac;
}
[System.Serializable]
public class DestinationData_Packetbeat
{
public int port;
public string ip;
public string mac;
}