Splunk Search

Using script to assign custom default fields

jamesvz84
Communicator

I have a powershell script that gets me the AD site name of the local host. It also gives me the IP address of the local host given the hostname. I'd like to add the output of this script as default (metadata) fields for all my events. Is this possible?

For example, host, source, sourcetype (among others) are metadata fields given to me by default. I'd like to add the fields "site" and "ip" (that values of which are provided to me by the script) to the list of metadata fields.

0 Karma
1 Solution

jamesvz84
Communicator

Thanks. Through some more investigation, it seems like automatic lookups are a better option for me and not as invasive as custom metadata/default fields. I can populate the lookup table through periodic running of a saved search that would take the latest host-ip-site data and populate a lookup table, then the automatic lookup will add the ip and site fields to the search results.

Also, looks like I can search on the ip and site fields as well (and not just display on search results), which is great and fulfills my requirements.

View solution in original post

0 Karma

jamesvz84
Communicator

Thanks. Through some more investigation, it seems like automatic lookups are a better option for me and not as invasive as custom metadata/default fields. I can populate the lookup table through periodic running of a saved search that would take the latest host-ip-site data and populate a lookup table, then the automatic lookup will add the ip and site fields to the search results.

Also, looks like I can search on the ip and site fields as well (and not just display on search results), which is great and fulfills my requirements.

0 Karma

dmaislin_splunk
Splunk Employee
Splunk Employee
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...