Getting Data In

How to edit my configurations to assign sourcetype?

ofaura
Path Finder

Hello,

I am trying to index following files:

 c:\test\access.log 
 c:\test\access_00.0.log
 c:\test\access_00.0.trc  
 c:\test\log\responses_01.0.trc
 c:\test\log\responses_01.0.log 

The sourcetypes for those files are:

 c:\test\access.log --> SAP
 c:\test\access_00.0.log --> SAP
 c:\test\access_00.0.trc  --> SAP 
 c:\test\log\responses_01.0.trc --> SAPResponse
 c:\test\log\responses_01.0.log --> SAP 

My inputs.conf file is following:

[monitor://C:\test\]
recursive = false
index = sap
disabled = false
whitelist=\.log$|\.trc$
ignoreOlderThan = 1d

[monitor://C:\test\log\]
recursive = true
index = sap
disabled = false
whitelist=\.log$|\.trc$
ignoreOlderThan = 1d

And my props.conf

[source::...\.log$]
sourcetype = SAP

[source::.../access_*.*.trc.*$]
sourcetype = SAPResponse

When files are indexed all them have the "default" sourcetype and it´s not the right ones that I have defined in props. Any idea why?

Thanks in advance,

0 Karma
1 Solution

ofaura
Path Finder

thanks for the suggestions provided. At the end, I have found the solution:

In inputs.conf

[monitor://C:\test2]
recursive = true
index = sap
disabled = false
whitelist=(.log|.trc)$
ignoreOlderThan = 1d

In props.conf

[source::C:\test2\log\resp*trc]
sourcetype = SAPResponse
priority = 10

[source::....(log*|trc*)]
sourcetype = SAP
priority = 5

Now Splunk gets the files and assign the right sourcetype for each file here.

View solution in original post

0 Karma

ofaura
Path Finder

thanks for the suggestions provided. At the end, I have found the solution:

In inputs.conf

[monitor://C:\test2]
recursive = true
index = sap
disabled = false
whitelist=(.log|.trc)$
ignoreOlderThan = 1d

In props.conf

[source::C:\test2\log\resp*trc]
sourcetype = SAPResponse
priority = 10

[source::....(log*|trc*)]
sourcetype = SAP
priority = 5

Now Splunk gets the files and assign the right sourcetype for each file here.

0 Karma

micahkemp
Champion

You probably want to specify sourcetype in your monitor stanza, creating new stanzas as necessary. You can use a TRANSFORMS action in props.conf to accomplish this, but for your needs I don't think it should be necessary.

Look at inputs.conf for how you can use .. and ... with wildcards to accomplish what you need here.

0 Karma

somesoni2
Revered Legend

What kind of forwarder you're using? Try putting pros.conf changes on Indexers.

Also, give this a try

inputs.conf on forwarder

[monitor://C:\test\access*.log]
recursive = false
index = sap
sourcetype = SAP
disabled = false
ignoreOlderThan = 1d

[monitor://C:\test\access*.trc]
recursive = false
index = sap
sourcetype = SAP
disabled = false
ignoreOlderThan = 1d

[monitor://C:\test\log\responses*.log]
recursive = false
index = sap
sourcetype = SAP
disabled = false
ignoreOlderThan = 1d

[monitor://C:\test\log\responses*.trc]
recursive = false
index = sap
sourcetype = SAPResponse
disabled = false
ignoreOlderThan = 1d
0 Karma
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!

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...

.conf25 Global Broadcast: Don’t Miss a Moment

Hello Splunkers, .conf25 is only a click away.  Not able to make it to .conf25 in person? No worries, you can ...