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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...