Splunk Search

Split one field values into multiple fields based on values

skodak
Explorer

status

success

success

 

failure

failure

error

error

 

I want output like

 

status         status 1 status2

success   failure      error

success   failure    error

Labels (1)
0 Karma
1 Solution

anilchaithu
Builder

@skodak 

you can use eval to split the field values

eval status1=if(like(status, "%failure%"), status, NULL), status2 = if(like(status, "%error%"), status, NULL), status=if(like(status, "%success%"), status, NULL)

 

Hope this helps

View solution in original post

0 Karma

anilchaithu
Builder

@skodak 

you can use eval to split the field values

eval status1=if(like(status, "%failure%"), status, NULL), status2 = if(like(status, "%error%"), status, NULL), status=if(like(status, "%success%"), status, NULL)

 

Hope this helps

0 Karma

skodak
Explorer

Thank you. This helped me to resolve the issue.

0 Karma

to4kawa
Ultra Champion
| makeresults
| eval _raw="status
success
success
failure
failure
error
error"
| multikv forceheader=1
| table status
| rename COMMENT as "the logic"
| streamstats dc(status) as session
| eval session="status".session
| stats list(status) as vstatus by session
| eval {session} = vstatus
| stats list(status*) as status*
0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...