Is this json format correct for upload to logstash/elasicsearch


#1

I have a series of json files created using tshark (see example below) which I would like to visualise eith ELK. Is the current json format ok for upload to logstash or do I need to parse it in some other format

[{"No.": "1", "Time": "0", "Source": "192.168.252.40", "Destination": "112.156.122.25", "Protocol": "TCP", "Length": "64", "Info": "9145 > 2323 [SYN] Seq=0 Win=12713 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]", "label": "normal"},{"No.": "2", "Time": "0.000615", "Source": "192.168.252.40", "Destination": "115.36.214.222", "Protocol": "TCP", "Length": "64", "Info": "9145 > 23 [SYN] Seq=0 Win=12713 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]", "label": "normal"}]


(Walker) #2

I'm not sure if the json filter will parse it out since it is contained in [] but you could always use the mutate function with gsub and regex to remove them prior to the json filter.


#3

thanks @wwalker

would it easier if the json file was just a series of one line dictionary key value pairs like below, although when I check this isnt a valid json format

{"No.": "No.", "Time": "Time", "Source": "Source", "Destination": "Destination", "Protocol": "Protocol", "Length": "Length", "Info": "Info", "label": "label"}
{"No.": "1", "Time": "0", "Source": "192.168.252.40", "Destination": "112.156.122.25", "Protocol": "TCP", "Length": "64", "Info": "9145 > 2323 [SYN] Seq=0 Win=12713 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]", "label": "normal"}
{"No.": "2", "Time": "0.000615", "Source": "192.168.252.40", "Destination": "115.36.214.222", "Protocol": "TCP", "Length": "64", "Info": "9145 > 23 [SYN] Seq=0 Win=12713 Len=0 [ETHERNET FRAME CHECK SEQUENCE INCORRECT]", "label": "normal"}