Getting Data In

Is there a way to set a tag by source in inputs.conf?

splunkto
Explorer

I'm writing an app where it has multiple sources that will be assigned to the sourcetype log4j. Searching for these logs for users is not straight forward because they need to search for something like "source=/full/app/path/*app.log*". Is there a way to tag at the source so instead the users could search for tag="appname" instead?

0 Karma

somesoni2
SplunkTrust
SplunkTrust

The tag is a search-time activity and can't be assigned in inputs.conf. I'm guessing a better option would be override the sourcetype to add the app name in the sourcetype itself so that you can search better (and it'll work with tstats command as well). Try like this

Indexer/Heavy Forwarder,

props.conf

[source::/fixed/portion/of/path/here.../app.log]
TRANSFORM-updatesourcetype = log4j_sourcetypeupdate

transforms.conf

[log4j_sourcetypeupdate]
SOURCE_KEY = MetaData:Source
REGEX = ....regex to find appname from file path....
FORMAT = sourcetype::log4j:$1
DEST_KEY =  MetaData:Sourcetype
0 Karma

splunkto
Explorer

If you do this, will it execute all of the apps set for [log4j]? The reason I have it using log4j is because it handles the index related stuff automatically.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...