Splunk Search

How do I edit my search to merge fields?

kiran331
Builder

Hi all,

I'm trying to merge fields. I need to have each value separately, but here I can see a group value as string. How can resolve this?

index=abc|rex max_match=0 "UDP_PORT=(?\d+)|TCP_PORT=(?\d+)"|search (PORT=* OR TCP_PORT=* OR UDP_PORT=* )| eval pn=(toString(PORT) + ";" + toString(TCP_PORT) + ";" + toString(UDP_PORT) )| makemv delim=";" pn|mvexpand pn| table _time pn

Result:

2016-06-03 16:13:01.940 22
2016-06-03 16:13:01.940 22 514 5520 8000

What I need is:

2016-06-03 16:13:01.940 22
2016-06-03 16:13:01.940 22
2016-06-03 16:13:01.940    514 
2016-06-03 16:13:01.940     5520
2016-06-03 16:13:01.940     8000

515, 5520, 8000 belongs to same event of field TCP

Tags (3)
0 Karma

woodcock
Esteemed Legend

Try this:

index=abc
| rex max_match=0 "UDP_PORT=(?\d+)|TCP_PORT=(?\d+)"
| search (PORT=* OR TCP_PORT=* OR UDP_PORT=* )
| mvexpand UDP_PORT
| mvexpand TCP_PORT
| eval pn =            if(isnotnull(PORT),         PORT, ";")
| eval pn = pn . ";" . if(isnotnull(TCP_PORT), TCP_PORT, ";")
| eval pn = pn . ";" . if(isnotnull(UDP_PORT), UDP_PORT, ";")
| table _time pn
| makemv delim=";" pn | mvexpand pn
0 Karma
Get Updates on the Splunk Community!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...