Getting Data In

Can a macro be created for an application based on the application setup.xml?

simpkins1958
Contributor

Our server can input data into Splunk either via Syslog or Http Event Collector. In our Splunk application, we want the user to be able to specify which method they are using and then create a macro based on that information. This is to handle our legacy Splunk application that currently only uses syslog. With our next release we are adding Http Event Collector too.

We want to configure setup.xml for our application to define a macro based on user input.

A boolean input for "Use Syslog Data"

In macros.conf file:

[DiagnosticsDataSource(1)]
args = diagnosticsType

if "Use Syslog Data" = true

definition = sourcetype=syslog LocalityServer "$diagnosticsType$"

else

definition = sourcetype= "$diagnosticsType$"

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Have you considered just OR'ing both options statically?

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Great. I've converted the comment to an answer, feel free to mark this as accepted if you're happy.

0 Karma

simpkins1958
Contributor

Thanks. This works.

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...