Splunk Search

search within a sub-search

atenciodeyka
New Member

I have been working on a search for a table view, what I want is to be able to see the results from this search from two different time frames o the same table, the first time frame brings back the results correctly; when I use the search command to run the same search with a different time frame to display it on the table is when things don't seem to be going well. This is the search:

index="XXX" sourcetype="XXX" host=$host1$ earliest=-37d@d latest=-30d@d action="drop" OR action=blocked | top limit=20 src | append [search index="XXX" sourcetype="XXXX" host=$host1$ earliest=-7d@d latest=now action="drop" OR action=blocked | top limit=20 src ]

Tags (1)
0 Karma

atenciodeyka
New Member

Ok, the only problem is that on the table I can't see both fields (src), the one from seach 1 and the other one from serch.

0 Karma

nick405060
Motivator

you didn't table src, is that the problem?

0 Karma

Sukisen1981
Champion

if you can see _time,_raw and host all you need is to add src field to the table

0 Karma

nick405060
Motivator

What exactly is the issue you're having? You should be able to do this without a problem.

I do exactly this pretty often - the only immediate difference I notice is that you don't have quotations around $host1$. Try that.

0 Karma

Sukisen1981
Champion

Looks like you are checking the search events , can you try this and check in the statistics tab?

index="XXX" sourcetype="XXX" host=$host1$ earliest=-37d@d latest=-30d@d action="drop" OR action=blocked | top limit=20 src |table _time,host,_raw| append [search index="XXX" sourcetype="XXXX" host=$host1$ earliest=-7d@d latest=now action="drop" OR action=blocked | top limit=20 src |table _time,host,_raw]
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Thanks for the Memories: .conf26 Took Learning to New Heights

Thank you, Splunk Community, for making .conf26 in Denver one for the books. From packed Splunk University ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Splunk Auto Ingestion Parallel Pipeline Scaling

Why this feature matters Many Splunk environments experience ingestion pressure long before the host is fully ...