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
Get Updates on the Splunk Community!

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...

Application management with Targeted Application Install for Victoria Experience

Experience a new era of flexibility in managing your Splunk Cloud Platform apps! With Targeted Application ...

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...