Getting Data In

How to utilize environmental variable in props.conf?

oliverja
Path Finder

This has been asked before, and the questions seems to die. So here I am with a slightly different use case/phrasing.

Dearest Splunk Devs, please let me use environmental variables in my configs.

Issue:

  1. I have several heavy forwarders collecting logs from different endpoints.

  2. My users need to know which heavy forwarder the logs passed through. 

  3. I want to add the Heavy Forwarder's hostname to the log as "collector"

Current situaiton:

transforms.conf

 

[addmeta]
REGEX = .
FORMAT = collector::$HOSTNAME
WRITE_META = true

 

props.conf

 

[generic_single_line]
TRANSFORMS-addmeta = addmeta

 

This results in the unfortunate log:

 

4/6/22
1:01:17.000 PM	
testing my props.conf with a simple log
collector = $HOSTNAME
sourcetype = generic_single_line

 

But what SHOULD be happening:

 

4/6/22
1:01:17.000 PM	
testing my props.conf with a simple log
collector = EventCollect01.domain.com
sourcetype = generic_single_line

 

What can I do to pull some sort of internal variable instead of hardcoding the host?

 

Labels (2)
0 Karma

OzUK
Explorer

I have this exact issue too, we have hundreds of UFs managed with CICD and want a way to stamp where logs are ingested from... how do we do this?

0 Karma

oliverja
Path Finder

FYI -- here is my suggestion I posted.

https://ideas.splunk.com/ideas/DSPID-I-167

richgalloway
SplunkTrust
SplunkTrust

There are only a few instances where environment variables are honored and props.conf is not among them.

Go to https://ideas.splunk.com to request it.

---
If this reply helps you, Karma would be appreciated.
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!

Thanks for the Memories! Splunk University, .conf25, and our Community

Thank you to everyone in the Splunk Community who joined us for .conf25, which kicked off with our iconic ...

Data Persistence in the OpenTelemetry Collector

This blog post is part of an ongoing series on OpenTelemetry. What happens if the OpenTelemetry collector ...

Introducing Splunk 10.0: Smarter, Faster, and More Powerful Than Ever

Now On Demand Whether you're managing complex deployments or looking to future-proof your data ...