Splunk Search

How to rename multiple field names and bind them by one common field?

CryoHydra
Path Finder

Team,

We have 3 different sourcetype on which endpoint/device are identified by different fieldname:

sourcetype=x endpoint identified by the field $host$ , sourcetype=y identified by $fqdn$ and sourcetype=z identified by $dns$

I want to bind all the devices to sourcetype , by renaming all the device field renamed to common field name $endpoint$. How to go over this?

host1 hos2 | stats count by sourcetype endpoint
0 Karma
1 Solution

renjith_nair
Legend

Try,

"your base search"|eval endpoint=case(sourcetype=="x",host,sourcetype=="y",fqdn,sourcetype=="z",dns)|stats count by sourcetype,endpoint
---
What goes around comes around. If it helps, hit it with Karma 🙂

View solution in original post

renjith_nair
Legend

Try,

"your base search"|eval endpoint=case(sourcetype=="x",host,sourcetype=="y",fqdn,sourcetype=="z",dns)|stats count by sourcetype,endpoint
---
What goes around comes around. If it helps, hit it with Karma 🙂

CryoHydra
Path Finder

Thanks !

host* - is the search string i used which mapped to host field host=host1 , host=host2 host=3

but host like client1 client2 which are present in log message for the host are also populating in the search with host=client1 host=client2 host=client3

How can i exclude host=client* ? using eval

0 Karma

renjith_nair
Legend

(host=host* AND host!=client* )

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma

CryoHydra
Path Finder

Thanks Renjith . But i used the below query which is time consuming.

"your base search"|eval endpoint=case(sourcetype=="x",host,sourcetype=="y",fqdn,sourcetype=="z",dns)|search endpoint=host* | stats count by sourcetype,endpoint

I have used the new field name to filter out events.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
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, ...