Getting Data In

How to configure different sourcetypes for logs in the same directory?

splunked38
Communicator

Hi,

I've got the following directory structure:

c:\Logs\<system>

At the moment, inputs.conf for application1 (search) is set to:

[monitor://c:\Logs\]
disabled = false
#host_segment 2 = system name
host_segment = 2
sourcetype = sourcetype1

The above config works.

However, I now have a requirement for another sourcetype. The system generates the logs into the same directory:

C:\logs\<system>\foo_sourcetype2.log

The inputs.conf for application2 named application2 will look like:

[monitor://c:\Logs\<system>\foo_sourcetype2.log]
disabled = false
sourcetype = sourcetype2

Unfortunately, this doesn't seem to be working.

I've also tried:

*blacklisting input.conf for application1 with: _sourcetype2.log - doesn't work

Thanks in advance.

0 Karma
1 Solution

somesoni2
Revered Legend

Try this in your inputs.conf

[monitor://c:\Logs\]
 disabled = false
 #host_segment 2 = system name
 host_segment = 2
 sourcetype = sourcetype1
blacklist = foo_sourcetype2\.log$

[monitor://c:\Logs\<system>\foo_sourcetype2.log]
 disabled = false
 sourcetype = sourcetype2

View solution in original post

somesoni2
Revered Legend

Try this in your inputs.conf

[monitor://c:\Logs\]
 disabled = false
 #host_segment 2 = system name
 host_segment = 2
 sourcetype = sourcetype1
blacklist = foo_sourcetype2\.log$

[monitor://c:\Logs\<system>\foo_sourcetype2.log]
 disabled = false
 sourcetype = sourcetype2

Luain
Engager

Cool. Thanks.

0 Karma

splunked38
Communicator

It seems that there was a (very long) delay after the restart, it was fine after it settled down.

The only addition as similar to @somesoni2:
blacklist = _sourcetype2.log

BTW: Can't add '$' on the regex as there are rotational logs in that directory

0 Karma

woodcock
Esteemed Legend

Make sure that the blacklist prevents the special files from being processed by the existing entry and then monitor the special files through a different path (be sure to have a good whitelist and blacklist here, too) by creating a soft link like this explains:

http://answers.splunk.com/answers/268433/data-input-path-name-is-the-same.html

Get Updates on the Splunk Community!

Splunk at Cisco Live 2025: Learning, Innovation, and a Little Bit of Mr. Brightside

Pack your bags (and maybe your dancing shoes)—Cisco Live is heading to San Diego, June 8–12, 2025, and Splunk ...

Splunk App Dev Community Updates – What’s New and What’s Next

Welcome to your go-to roundup of everything happening in the Splunk App Dev Community! Whether you're building ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco &#43; Splunk! We’ve ...