Splunk Search

How to combine my two searches and create a time chart with the resulting data?

prakashbhanu407
New Member

I have to add 2 searches. Each search's output is FileName and Time....and I have to create a graph with the 2 types of file counts against time.

I used the search below:

index=MyIndex  (   (filename=PNASC.HRBDT.*)   OR   (filename=PNASC.MBRETRAN.*) ) status=1 |rename filename as FileNameA, _time as Time | table "FileNameA" status
append status [ search index=MyIndex   (  (filename=CFCF.GRP*.txt)   OR  (filename=CFCF.MBR*.txt) )   status=1 |rename filename as "FileNameB", _time as Time |table "FileNameB" status
] timechart span=1d count("FileNameA") count("FileNameB")

but getting errors

tried Join too, but I don't have any common field with same values.

0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Try like this (assuming all data lies in same MyIndex)

index=MyIndex   filename=PNASC.HRBDT.* OR   filename=PNASC.MBRETRAN.* OR filename=CFCF.GRP*.txt OR  filename=CFCF.MBR*.txt status=1 | eval Type=if(like(filename,"PNASC.HRBDT.%") OR like(filename,"PNASC.MBRETRAN.%"),"FileNameA","FileNameB")
| timechart span=1d count by Type

View solution in original post

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try like this (assuming all data lies in same MyIndex)

index=MyIndex   filename=PNASC.HRBDT.* OR   filename=PNASC.MBRETRAN.* OR filename=CFCF.GRP*.txt OR  filename=CFCF.MBR*.txt status=1 | eval Type=if(like(filename,"PNASC.HRBDT.%") OR like(filename,"PNASC.MBRETRAN.%"),"FileNameA","FileNameB")
| timechart span=1d count by Type
0 Karma

prakashbhanu407
New Member

Worked like a charm ...thanks

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