Splunk Search

How to break single event(JSON response) to multi events?

splunkaspirant
New Member

Hello guys,

I have some problem with breaking the json event. Where i made some REST API get request to get the data from some other monitoring tool.
I made a request in such a way i want to grab the results in the last 60 seconds.
My response is getting fetched in a single event for 60 seconds time frame. I wanted to break the event in to seperate events. I am pasting the response in below.
If some one helps on this it would be great. Thanks in advance.

MY RESPONSE AS SINGLE EVENT.

https://app.thousandeyes.com/view/tests?__a=11035&testId=140152&roundId=1503878700&agentId=28091"},{..., TX","countryId":"US","date":"2017-08-28 00:05:07","agentId":7056,"roundId":1503878700,"permalink":"https://app.thousandeyes.com/view/tests?__a=11035&testId=140152&roundId=1503878700&agentId=7056"},{"..., MN","countryId":"US","date":"2017-08-28 00:05:03","agentId":16931,"roundId":1503878700,"permalink":"https://app.thousandeyes.com/view/tests?__a=11035&testId=140152&roundId=1503878700&agentId=16931"},{..., IL","countryId":"US","date":"2017-08-28 00:05:15","agentId":31,"roundId":1503878700,"permalink":"https://app.thousandeyes.com/view/tests?__a=11035&testId=140152&roundId=1503878700&agentId=31"},
I WANT TO BREAK IN TO MULTI LINE EVENTS AS BELOW.

{"avgLatency":57.0,"loss":0.0,"maxLatency":57.0,"jitter":0.48,"minLatency":56.0,"serverIp":"206.123.121.1","agentName":"Edmonton, Canada","countryId":"CA","date":"2017-08-28 00:05:13","agentId":28091,"roundId":1503878700,"permalink":"https://app.thousandeyes.com/view/tests?__a=11035&testId=140152&roundId=1503878700&agentId=28091"},

{"avgLatency":5.0,"loss":0.0,"maxLatency":6.0,"jitter":0.1472,"minLatency":5.0,"serverIp":"206.123.121.1","agentName":"Houston, TX","countryId":"US","date":"2017-08-28 00:05:07","agentId":7056,"roundId":1503878700,"permalink":"https://app.thousandeyes.com/view/tests?__a=11035&testId=140152&roundId=1503878700&agentId=7056"},

{"avgLatency":33.0,"loss":0.0,"maxLatency":33.0,"jitter":0.0,"minLatency":33.0,"serverIp":"206.123.121.1","agentName":"Chicago, IL","countryId":"US","date":"2017-08-28 00:05:15","agentId":31,"roundId":1503878700,"permalink":"https://app.thousandeyes.com/view/tests?__a=11035&testId=140152&roundId=1503878700&agentId=31"},

Tags (1)
0 Karma

hardikJsheth
Motivator

I would suggest you just apply KV_MODE=JSON and Splunk will correctly parse JSON events as list and you can use spath query to fetch individual events.

In case you want to break events as mentioned, you can set break only before to REGEX as follows in props.conf for your sourcetype

\{\"avgLatency\"
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!

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...