Splunk Search

Filtering for specific hosts or indexes

ebdavis333
New Member

The search string I am currently using is the following:

| metadata type=hosts |where recentTime < now() - 86400 | eval lastSeen = strftime(recentTime, "%F %T") | fields + host lastSeen | sort - lastSeen

I would like to be able to use that as a base search but be able to append some more specific filters such as:

host=abc*

index=dns

The first command that came to mind was adding a pipe search at the end, but that doesn't seem to work properly. I know this may be elementary for some of you Splunkers out there, but can anyone offer a quick hand? Much appreciated!

Brian

Tags (2)
0 Karma
1 Solution

pradeepkumarg
Influencer

You can append the following

|search host=abc*

View solution in original post

aweitzman
Motivator

You can do something like adding the following after the end:

| where host="abc*"

You're going to have to add index to the list of fields in your fields command if you want to be able to filter on those, though.

0 Karma

pradeepkumarg
Influencer

You can append the following

|search host=abc*

ebdavis333
New Member

I was doing this yesterday and it didn't seem to return any results, but works today. Thanks all for your contributions!

0 Karma
Get Updates on the Splunk Community!

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

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...