Getting Data In

Changing Syslog Source type for directories

nkitmitto
Explorer

We're using Syslog-ng in our environment and have a forwarder setup on syslog-ng to forward the logs to Splunk. But when they're indexed in Splunk, the sourcetype is "syslog". Is it possible to set this to the actual source type? For example our syslog-ng directory structure looks like such:

/logs/log-type/hostname/

I want to be able to set log-type to be the sourcetype in Splunk. It has to be possible!

1 Solution

kristian_kolb
Ultra Champion

You would have to set up different monitor stanzas in inputs.conf on the forwarder, e.g.;

[monitor:///logs/nginx/*/]
index = your_index
sourcetype = nginx
host_segment = 3

[monitor:///logs/cisco/*/]
index = your_index
sourcetype = cisco
host_segment = 3

etc etc

If you do not specify sourcetype (which I assume you have not done) Splunk will probably identify and classify it as syslog. And syslog is a sourcetype (the only one I think) where Splunk will automatically extract and set the host for each event in the log individually, i.e. not on a per file basis.

Therefore you will also have to set the host value manually, but the host_segment lets you set this from the path being monitored.

Hope this helps,

Kristian

View solution in original post

nkitmitto
Explorer

In the inputs file, I have this and it worked:

[monitor:///logs/static-httpd-error-log/*/*.log]
sourcetype = static-httpd-error-log
index = main
host_segment = 3

Thanks for the help!

0 Karma

kristian_kolb
Ultra Champion

you are most welcome. /k

0 Karma

kristian_kolb
Ultra Champion

You would have to set up different monitor stanzas in inputs.conf on the forwarder, e.g.;

[monitor:///logs/nginx/*/]
index = your_index
sourcetype = nginx
host_segment = 3

[monitor:///logs/cisco/*/]
index = your_index
sourcetype = cisco
host_segment = 3

etc etc

If you do not specify sourcetype (which I assume you have not done) Splunk will probably identify and classify it as syslog. And syslog is a sourcetype (the only one I think) where Splunk will automatically extract and set the host for each event in the log individually, i.e. not on a per file basis.

Therefore you will also have to set the host value manually, but the host_segment lets you set this from the path being monitored.

Hope this helps,

Kristian

nkitmitto
Explorer

This goes on the forwarder? Or should it be on the inputs.conf on the index?

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 ...