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!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...