Getting Data In

JSON input not splitting up in single line

rishma
Explorer

I am using API to fetch the JSON logs and sending JSON output to Splunk. Props.conf is on the search head.

I am seeing the intermittent issues of not splitting the JSON logs even though I am sending one by one JSON objects via scripting.

Json payload :

{"test": "emailid", "remote": "13.17.14.2", "guide": "05773-56-C2-E9", "test1": "testing", "date": "2019-12-13T19:05:03.836+00:00", "sessionID": "abc1"}
{"remote": "13.7.4.28", "guide": "05773-56-C2-E9", "test1": "testing", "date": "2019-12-13T19:05:03.836+00:00", "sessionID": "abc1"}

Props.conf is :

INDEXED_EXTRACTIONS = JSON
BREAK_ONLY_BEFORE_DATE=false
BREAK_ONLY_BEFORE=(\{\"|\"\})
MUST_BREAK_AFTER=\"\}

Please guide.

I tried including SHOULD_LINEMERGE = false

But it didnt work.

0 Karma

woodcock
Esteemed Legend

Never use the BREAK_* settings; always do it like this (these are the only breaking settings required):

SHOULD_LINEMERGE = false
LINE_BREAKER = \"\}(\s*[\r\n]+\s*)(?:\{\")|(?:\"\})
0 Karma

to4kawa
Ultra Champion
| makeresults 
| eval _raw= "{\"test\": \"emailid\" , \"remote\": \"13.17.14.2\", \"guide\": \"05773-56-C2-E9\", \"test1\": \"testing\", \"date\": \"2019-12-13T19:05:03.836+00:00\", \"sessionID\": \"abc1\"}" 
| appendpipe 
    [| eval _raw="{\"remote\": \"13.7.4.28\", \"guide\": \"05773-56-C2-E9\", \"test1\": \"testing\", \"date\": \"2019-12-13T19:05:03.836+00:00\", \"sessionID\": \"abc1\"}" ] 
| eval _time=strptime(spath(_raw,"date"),"%Y-%m-%dT%H:%M:%S.%Q%:z")
| spath

If it is a search, it can be extracted correctly.

why-would-indexed-extractionsjson-in-propsconf

How about using this as a reference?

0 Karma

rishma
Explorer

Its intermittent issue. The data is different in each payload. Can it be done while indexing rather than searching. Please guide.

0 Karma

to4kawa
Ultra Champion

Sorry, I don’t know how.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

[Puzzles] Solve, Learn, Repeat: Character substitutions with Regular Expressions

This challenge was first posted on Slack #puzzles channelFor BORE at .conf23, we had a puzzle question which ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

[Puzzles] Solve, Learn, Repeat: Matching cron expressions

This puzzle (first published here) is based on matching timestamps to cron expressions.All the timestamps ...