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!

A Four-Part Event Series: Full Stack Observability For the AI Era

As AI reshapes applications, infrastructure, and the way teams operate, the traditional boundaries of ...

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...