Splunk Search

How to append search as new row?

jaj
Path Finder

Given the following query, how can I append the second query so that the results show up as two rows so I can graph the results (in a pie chart).

// This query appends a new search as an additional col but what I really want i a new row.
source=*/blah/the.log "labelData= " | stats count as NOMATCHES
| appendcols [search source=*/blah/the.log labelData!="" | stats count as MATCHES ]

Tags (2)
1 Solution

yannK
Splunk Employee
Splunk Employee

try the append instead of appendcols

View solution in original post

yannK
Splunk Employee
Splunk Employee

try the append instead of appendcols

jaj
Path Finder

single query is exactly what I was looking for...I just what i was looking for...the labelData= was messing my query up as I couldn't query it by null or by labelData="". This worked awesome! Thanks!

0 Karma

yannK
Splunk Employee
Splunk Employee

but you could also do all in a single search with an eval or a case and define your own field.

example

source=*/blah/the.log "labelData= " OR labelData!=""
| eval label=if(isnull(labelData),"nomatch","match")
| stats count by label

somesoni2
Revered Legend

just use "append" instead of "appendcols"

Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...