Getting Data In

Searching JSON data

danwollwich
New Member

Hi,

I'm trying to search some JSON data I've imported. Its of the format below.

{ "_id" : { "ip" : “192.1”68.1.1, "p" : 443, "h" : "d077c796eeddd46da45adfcd74116e2" }, "ip" : “192.168”.1.1, "port" : 443, "proto" : "tcp", "banner" : "HTTP/1.1 200 OK\r\nDate: Tue, 15 May 2012 05:30:04 GMT\r\n\nServer: Apache/2.2.15 (CentOS)\r\nLast-Modified: Mon, 24 Oct 2011 14:40\n:33 GMT\r\nETag: \"900cdb-38-4b00c67c36967\"\r\nAccept-Ranges: bytes\r\nC\nontent-Length: 56\r\nConnection: close\r\nContent-Type: text/html; char\nset=UTF-8\r\n\r\n\n

\n\n", "geo" : { "c" : "USA", "loc" : [ 38, -97 ] }, "name" : "https", "t" : { "$date" : 1337059668000 } }

I can do basic searches against things like the IP address but when i want to search for matching items such as the Server type, in this case Apache/2.2.15(CentOS) I seem to fall foul of some of the characters. How would i do matches for this type of data or others like Content Length? Trying to match on something that has a : on it seems to break the search term.

Thanks in advance

Dan

Tags (2)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

hi danwollwich,

try the spath search command, it is a special search command for XML and JSON events. Find more information in the docs about spath.

hope this helps ...

cheers, MuS

View solution in original post

MuS
SplunkTrust
SplunkTrust

hi danwollwich,

try the spath search command, it is a special search command for XML and JSON events. Find more information in the docs about spath.

hope this helps ...

cheers, MuS

Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...