Splunk Search

append two search result by #

crazyeva
Contributor

I want to append two (or more) search results by event number
search1:
# _raw
1 a
2 b
3 c
search2:
# _raw
1 x
2 y
3 z
I want a result as:
# raw1 raw2
1 a x
2 b y
3 c z
Any one could help me? Thanks

Tags (1)
0 Karma
1 Solution

Ayn
Legend

You could use appendcols. The only caveat is that it requires a stats command to be run before it, so you can't use it with table. You could work around this by grabbing the _raw fields one by one anyway, like below.

search1 | stats first(_raw) as raw1 by _raw | appendcols [search search2 | stats first(_raw) as raw2 by _raw]

View solution in original post

Ayn
Legend

You could use appendcols. The only caveat is that it requires a stats command to be run before it, so you can't use it with table. You could work around this by grabbing the _raw fields one by one anyway, like below.

search1 | stats first(_raw) as raw1 by _raw | appendcols [search search2 | stats first(_raw) as raw2 by _raw]

crazyeva
Contributor

Thank you! its very cool of "first() by _raw" much better than "list"
Does first(filed1) by filed1 mean "value"?

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 ...