Splunk Search

Split merged events

zoebanning
Path Finder

Hello Splunk Community, 

 

I have a merged event which shows if a service is running or down. Here is an example of the event in splunk:

 

******************************************************************************* All services are running

1092827|default|service1is running

37238191|default|service2 is running

16272373|default|service3 is running

*******************************************************************************

 

How can I split the merged events so I can extract the service name, status (running/down) & host?

16272373|default|service3 is running

Host |      | ServiceName is Status

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Here's one way to do it.  

| makeresults | eval _raw="******************************************************************************* All services are running

1092827|default|service1 is running

37238191|default|service2 is running

16272373|default|service3 is running

*******************************************************************************"
```The above just defines test data```
```Copy the raw event because we can't split _raw.```
| eval data=_raw
```Divide the event into lines```
| eval data=split(data,"
")
```Create one event for each line```
| mvexpand data
```Put _raw back```.
| eval _raw=data
```Filter out "****" and blank lines```
| regex "^\d"
```Extract host, service, and status fields```
| rex "(?<Host>\d+)\|\w+\|(?<service>\S+) is (?<status>\S+)"
```Display the fields```
| table Host service status
---
If this reply helps you, Karma would be appreciated.
0 Karma

bowesmana
SplunkTrust
SplunkTrust

You can run this example

| makeresults
| eval _raw="******************************************************************************* All services are running

1092827|default|service1 is running

37238191|default|service2 is running

16272373|default|service3 is running

*******************************************************************************"
| rex max_match=0 "(?<event>\d+\|default\|.*)"
| mvexpand event
| table event
| rex field=event "(?<host>\d+)\|default\|(?<service>\w+)\sis\s(?<status>.*)"
| table host service status

It shows you a way to extract the original event from the multiline merged data and then to expand those to individual events. The second rex then extracts those fields.

 

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!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...