Dashboards & Visualizations

Is there a way to filter by source in a post process search?

Sundried
Explorer

Hi,

I have a base search and post process searches on a dashboard that need to be split by source, but it doesn't appear like splitting by source works. The only thing shared is the index, and some fields but depending on the source I need to evaluate the fields differently. For instance:

Base search:
index=test_logs | fields A

 

Two post process searches:

| search source=sourceA

.

(evaluate field A certain way because it's from source A)

 

| search source=sourceB

.

(evaluate field A a different way as it's from source B)

 

The problem is that when I do this nothing will load. I've found the only way to get this to work is to put the source in the base search but then I wouldn't be able to do my evaluations properly.

Labels (1)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

Just add 'source' to your fields statement in the base search.

There's no reason why that shouldn't work for your panel searches. What is your result?

If you get no results, open the search up in a new window from the panel magnifying glass and see what the search gives you.

 

View solution in original post

0 Karma

bowesmana
SplunkTrust
SplunkTrust

If you have a base search with

| fields A

then you will only have one field 'A' - you will not have a field called source.

The best use of base searches is to aggregate rather than just pass raw events - although that's possible.

Can you give more detail on what your two post process searches want to do with a little more detail.

What do you mean 'can't do your evaluation properly'?

0 Karma

Sundried
Explorer

So field A is a common field, which are names of files. The way they have been onboarded is that they are separated by a source name, so source A field A will be a set of files that are evaluated under one panel. Then source B field A are a set of files too, but to be evaluated under another panel with different parameters/output.

I've tried to put the sources in the base search and then calling the sources again in their respective panels but nothing loads too.

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Can you post your SPL of the base + the panel searches

0 Karma

Sundried
Explorer

Base:

 

index=logs source=A OR source=sourceB | fields fileName

 

Panel 1:

search source=sourceA

| table fileName

 

Panel 2:

search source=sourceB

| table fileName

0 Karma

bowesmana
SplunkTrust
SplunkTrust

Just add 'source' to your fields statement in the base search.

There's no reason why that shouldn't work for your panel searches. What is your result?

If you get no results, open the search up in a new window from the panel magnifying glass and see what the search gives you.

 

0 Karma

Sundried
Explorer

This worked. Thanks mate. Didn't know source was treated that way.

0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Wondering How to Build Resiliency in the Cloud?

IT leaders are choosing Splunk Cloud as an ideal cloud transformation platform to drive business resilience,  ...

Updated Data Management and AWS GDI Inventory in Splunk Observability

We’re making some changes to Data Management and Infrastructure Inventory for AWS. The Data Management page, ...