Getting Data In

Breaking events JSON

mmoermans
Path Finder

For some reason the LINE_BREAKER option for Splunk keeps turning a JSON log file into a single event, ignoring everything after the first event. Does anyone have any experience with breaking the events up for the following log?:

{"aModLR":{"attributes":{"affected":"topology/pod/node/av/node","cause":"transition","changeSet":"targetMn (Old: AAA, New: BBB)","childAction":"","clientTag":"","code":"E69","created":"2019-07-18T16:38:41.501+02:00","descr":"Node modified","dn":"subj-[topology/pod/node/av/node]/mod-43243","id":"23432","ind":"modification","modTs":"never","sessionId":"ABCD",severity":"info","status":"","trig":"config","txId":"18374686479671625257","user":"admin"}}},{"aModLR":{"attributes":{"affected":"pluginPolContr/pluginPol","cause":"transition","changeSet":"verifySignature:enable","childAction":"","clientTag":"","code":"E68","created":"2019-07-18T10:31:11.748+02:00","descr":"PluginPol created","dn":"subj-[pluginPolContr/pluginPol]/mod-1234","id":"12345","ind":"creation","modTs":"never","sessionId":"ABCDEF123",severity":"info","status":"","trig":"config","txId":"5645","user":"admin2"}}}

I've tried BREAK_ONLY_BEFORE = {"aModLR" or LINE_BREAKER = {"aModLR() but it still turns it into a single event.

0 Karma

to4kawa
Ultra Champion
LINE_BREAKER = \{\"aModLR\"

I think you need to escape the string.

| makeresults 
| eval _raw="{\"aModLR\":{\"attributes\":{\"affected\":\"topology/pod/node/av/node\",\"cause\":\"transition\",\"changeSet\":\"targetMn (Old: AAA, New: BBB)\",\"childAction\":\"\",\"clientTag\":\"\",\"code\":\"E69\",\"created\":\"2019-07-18T16:38:41.501+02:00\",\"descr\":\"Node modified\",\"dn\":\"subj-[topology/pod/node/av/node]/mod-43243\",\"id\":\"23432\",\"ind\":\"modification\",\"modTs\":\"never\",\"sessionId\":\"ABCD\",\"severity\":\"info\",\"status\":\"\",\"trig\":\"config\",\"txId\":\"18374686479671625257\",\"user\":\"admin\"}}}"
| appendpipe 
    [eval _raw="{\"aModLR\":{\"attributes\":{\"affected\":\"pluginPolContr/pluginPol\",\"cause\":\"transition\",\"changeSet\":\"verifySignature:enable\",\"childAction\":\"\",\"clientTag\":\"\",\"code\":\"E68\",\"created\":\"2019-07-18T10:31:11.748+02:00\",\"descr\":\"PluginPol created\",\"dn\":\"subj-[pluginPolContr/pluginPol]/mod-1234\",\"id\":\"12345\",\"ind\":\"creation\",\"modTs\":\"never\",\"sessionId\":\"ABCDEF123\",\"severity\":\"info\",\"status\":\"\",\"trig\":\"config\",\"txId\":\"5645\",\"user\":\"admin2\"}}}"]
| rex mode=sed "s/({|\\\",)/\1\n/g"
| spath

I tried extracting fields with a query as an example.

0 Karma
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In January, the Splunk Threat Research Team had one release of new security content via the Splunk ES Content ...

Expert Tips from Splunk Professional Services, Ensuring Compliance, and More New ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Observability Release Update: AI Assistant, AppD + Observability Cloud Integrations & ...

This month’s releases across the Splunk Observability portfolio deliver earlier detection and faster ...