Splunk Search

Searching in multiple indexes

willadams
Contributor

I am trying to create a search to do the following:

1) Look in a table where information is tagged in a certain way
2) Using the results of this search, search another index for a piece of data
3) Using the results of the original search, search another index for another piece of data

So my scenario is I have a list of important assets. This can be seen as

index=assets source=import_assets.csv <== the value I am interested in here is the host name, so we will call the field "nt_host". So example results

SRV1
SRV2
SRV5

I have another index that contains information about that asset. This information may be a list of apps installed. This can be seen as

index=software <== this has a specific field value that I would like to check. This field may be "app_name" which contains a list of different apps. If I just ran this search, the results may be

server_name=SRV1
app_name=Flash
app_name=SUF
app_name=agentx

server_name=SRV2
app_name=Flash
app_name=SUF
app_name=agentx

server_name=SRV3
app_name=Flash
app_name=SUF
app_name=agentx

server_name=SRV4
app_name=Flash
app_name=SUF
app_name=agentx

server_name=SRV5
app_name=Flash
app_name=agentx

My objective here is to create a table that shows my "important assets" have an application installed. So my table would show "the server name", and whether the app is installed or not (this would use an eval and if match to determine a "yes" or "no". So illustrating this

[Server Name] | [App Name] | [App Name2]

SRV1 | Yes | No
SRV2 | Yes | Yes
SRV5 | No | Yes

I have attempted the following searches but I end up with no results or a parsing job that goes forever

index=assets source=import_assets.csv | join type = inner max=0 nt_host [search index=software | rename server_name AS nt_host]

index=assets source=import_assets.csv | join type = inner max=0 nt_host [search index=software | rename server_name AS nt_host | fields nt_host]

index=assets source=import_assets.csv | where [search index=software | rename server_name AS nt_host | fields nt_host]

I also attempted to constrain the search by specifying a host in the first index search but this didn't end up with a result

index=assets source=import_assets.csv nt_host=SRV5 | join type = inner max=0 nt_host [search index=software | rename server_name AS nt_host]

woodcock
Esteemed Legend

Like this:

index="software" AND [ search index="assets" AND source="import_assets.csv"
| stats count by nt_host
| table nt_host
| rename nt_host AS server_name ]
| chart limit=0 count BY server_name app_name
| replace 0 WITH "NO", 1 with "YES"

gcusello
SplunkTrust
SplunkTrust

Hi @willadams,
try something like this:

index=software OR (index=assets source=import_assets.csv)
| rename nt_host AS server_name
| stats count BY server_name app_name
| eval status=if(count=0,"No","Yes")
| xyseries server_name app_name status
| fillnull value="No"

I cannot check your search, but this example is ok:

index=wineventlog | stats count BY EventCode Dominio_account
| eval status=if(count=0,"No","Yes")
| xyseries EventCode Dominio_account status
| fillnull value="No"

Ciao.
Giuseppe

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!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...