Splunk Search

How to filter out events to make a search out of it?

AL3Z
Path Finder

Hi,
I want to create a search out of the below event, to raise an alert if the particular system having the label lostinterface or label is  not there  and in profiles we have 2 values i.e  tndsubnet1 and  tndsubnet2, how we can make the search to seperate out the systems in tndsubnets 1 and tndsubnets 2 accordingly to make a search


Thanks..

Labels (1)
0 Karma

scelikok
SplunkTrust
SplunkTrust

@AL3Z,

Could you please share sample events?

 

 

If this reply helps you an upvote is appreciated.
0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @AL3Z ,

@yuanliu's solution should work but I think your field name is "labels" not "Labels". Field names are case sensitive. Please try below;

| fillnull labels value=manage

 

If this reply helps you an upvote is appreciated.
0 Karma

AL3Z
Path Finder

@scelikok , @yuanliu   Hi, 

I have been receiving alerts with an empty hostname string. In all the events, the hostname is missing. To resolve this, I plan to create a field named "asset_found." If a hostname is found, it will be added to this field. In the absence of a hostname, the mac address will be added, and if that too is unavailable, an empty string will be added.
could you help with the search.

thanks..

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @AL3Z,

You can use below eval to create asset_found field.

| eval asset_found=coalesce(hostname, mac_address,"")
If this reply helps you an upvote is appreciated.

AL3Z
Path Finder

@scelikok ,

 

this is not working  ????

0 Karma

yuanliu
SplunkTrust
SplunkTrust

You have to understand that "Is not working" conveys little information even in the best of cases.  The phrase is useless when other parties in the discussion have no insight about your data.  Can you illustrate data?  Explain data characteristics?  What is the code you attempted?  What is the result?  You are making volunteers shooting in the dark.

0 Karma

scelikok
SplunkTrust
SplunkTrust

Hi @AL3Z,

You can try below;

| stats latest(Labels) as Labels by profile
| where isnull(Labels) or Lables="lostinterface"
If this reply helps you an upvote is appreciated.

AL3Z
Path Finder

Hi @@

How we can fill the empty values of a "labels" field with a  string "manage"

Thanks

 

 

 

0 Karma

yuanliu
SplunkTrust
SplunkTrust

You can use fillnull to replace null values, or you can use if() function to define a value when original value isnull.  Using @scelikok's solution:

| stats latest(Labels) as Labels by profile
| where isnull(Labels) or Labels="lostinterface"
| fillnull Labels value=manage

or

| stats latest(Labels) as Labels by profile
| where isnull(Labels) or Labels="lostinterface"
| eval Labels = if(isnull(Labels), "manage", Labels)

 

Tags (1)
0 Karma

AL3Z
Path Finder

@yuanliu ,
its not working .

0 Karma
Get Updates on the Splunk Community!

Dashboard Studio Challenge - Learn New Tricks, Showcase Your Skills, and Win Prizes!

Reimagine what you can do with your dashboards. Dashboard Studio is Splunk’s newest dashboard builder to ...

Introducing Edge Processor: Next Gen Data Transformation

We get it - not only can it take a lot of time, money and resources to get data into Splunk, but it also takes ...

Take the 2021 Splunk Career Survey for $50 in Amazon Cash

Help us learn about how Splunk has impacted your career by taking the 2021 Splunk Career Survey. Last year’s ...