Monitoring Splunk

How to monitor specific sub folders

avitallange
Explorer

Hi,

I have the following folder structure:
C:\temp\logs\ComponentName1\InstanceName1\log.txt
C:\temp\logs\ComponentName2\InstanceName3\FolderToExclude

There are various ComponentName folders and 3 InstanceName folders under each component.

I'd like:

  1. To collect the log.txt files of all components from all their instances and only them. I.e. to exclude all other files folders such as FolderToExclude\fileToExclude.txt.
  2. To extract the fields ComponentName and InstanceName so I can filter according them.

For #1 I tired to add in "C:\Program Files\Splunk\etc\system\local\inputs.conf"
the following line:
[monitor://c:\temp\logs\.\(InstanceName1|InstanceName2|InstanceName3)\..txt]
sourcetype = MySourceType

I restarted splunkd and splunkweb but it didn't help.
When I create a new file under C:\temp\logs\ComponentName2\InstanceName3\FolderToExclude it is still monitored.

For #2 I think I should add a stanza [MySourceType] contains

EXTRACT-extract_ComponentName = ?????

EXTRACT-extract_InstanceName = ?????

but I am not sure how to do this.

Could you please help?

Thanks!

Tags (2)
0 Karma

linu1988
Champion

Please mark answer if it gave you the solution, may help others as well

0 Karma

avitallange
Explorer

Thanks, I got what I want!

0 Karma

linu1988
Champion

Please follow the monitor stanza in the below documentation.

http://docs.splunk.com/Documentation/Splunk/5.0.3/Admin/Inputsconf

Monitor the parent directory with "recursive = true"
and define whitelist=(.)*.txt to see if only the .txt files are monitored. Thanks

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