Splunk Enterprise Security

How to edit my search to get the required common value?

sumanssah
Communicator

I am trying to create an rule with 2 information "Expected Host Not Reporting" & "Network Device Interface Down"

I would expect common host name from both searches, however not getting common host name with below mentioned search

| `host_eventcount(30,2)` | search is_expected=true | stats count by host | appendcols [search source="udp:50001" facility=ETHPORT port_status=down |stats count by host] |

BR
......SS

0 Karma
1 Solution

woodcock
Esteemed Legend

The appendcols command is joiner-agnostic; it does a blind row-to-row merge of the 2 datasets. This is clearly not what you are desiring; it appears that you are trying to do a merge of the 2 datasets based on a common key so try this:

index=AlwaysUseAnIndexSpecifierYouNaughtyUser sourcetype="IJustToldYouAlwaysUseSpecifiersWhenYouCan" source="udp:50001" facility=ETHPORT port_status=down
| appendpipe [| `host_eventcount(30,2)` | search is_expected=true ]
| stats count(eval(port_status=down)) AS PORT_DOWN_COUNT count(eval(is_expected=true))) AS SOME_OTHER_COUNT BY host

It would be clearer if you used count(eval(sourcetype="A")) and count(eval(sourcetype="B")) but I had to go with what I could see in your searches.

View solution in original post

0 Karma

woodcock
Esteemed Legend

The appendcols command is joiner-agnostic; it does a blind row-to-row merge of the 2 datasets. This is clearly not what you are desiring; it appears that you are trying to do a merge of the 2 datasets based on a common key so try this:

index=AlwaysUseAnIndexSpecifierYouNaughtyUser sourcetype="IJustToldYouAlwaysUseSpecifiersWhenYouCan" source="udp:50001" facility=ETHPORT port_status=down
| appendpipe [| `host_eventcount(30,2)` | search is_expected=true ]
| stats count(eval(port_status=down)) AS PORT_DOWN_COUNT count(eval(is_expected=true))) AS SOME_OTHER_COUNT BY host

It would be clearer if you used count(eval(sourcetype="A")) and count(eval(sourcetype="B")) but I had to go with what I could see in your searches.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.


Introducing Unified TDIR with the New Enterprise Security 8.2

Read the blog
Get Updates on the Splunk Community!

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...

Splunk AI Assistant for SPL vs. ChatGPT: Which One is Better?

In the age of AI, every tool promises to make our lives easier. From summarizing content to writing code, ...