Getting Data In

How to correctly configure Splunk to monitor a directory with wildcards?

rewritex
Contributor

I must be doing something wrong. Splunk is seeing and indexing the first log file it finds and nothing else after within the same folder and nothing else after in the other folders. Any advice? Thank you. -Sean

Full path to log files are (sact01 - sact15):

/logs/sam/ct/sact01/section01/web
/logs/sam/ct/sact01/sec-02/web
/logs/sam/ct/sact01/sec-03/web
/logs/sam/ct/sact02/section01/web
/logs/sam/ct/sact02/sec-02/web
/logs/sam/ct/sact02/sec-03/web

Log files name format within /web (4 months worth, but i only need 7 days):

request.log.2017-02-28-13-16-04
request.log.2017-03-01-08-12-04
request.log.2017-03-02-13-33-04

Inputs.conf

[monitor:///logs/sam/ct/sact0*/.../web]
_TCP_ROUTING = WestCoast0102
disabled = false
index = test-i007
sourcetype = sam
whitelist = request\.logs*$
crcSalt = <SOURCE>
ignoreOlderThan = 7d

index=_internal source="/opt/splunkforwarder/var/log/splunk/splunkd.log

TailingProcessor - Adding watch on path: /logs/sam/ct.
TailingProcessor - Parsing configuration stanza: monitor:///logs/sam/ct/sactws0*/.../web.
0 Karma
1 Solution

rewritex
Contributor

This is resolved. I had to add the ending /
This works: [monitor:///logs/sam/ct/sact0*/*/web/]

View solution in original post

0 Karma

rewritex
Contributor

This is resolved. I had to add the ending /
This works: [monitor:///logs/sam/ct/sact0*/*/web/]

0 Karma

rewritex
Contributor

This is resolved. I had to add the ending /
This works: [monitor:///logs/sam/ct/sact0*/*/web/]

0 Karma

woodcock
Esteemed Legend

Yes, otherwise it thinks that you are specifying a file name, not a directory.

0 Karma

rewritex
Contributor

I corrected the whitelist = request.logs*$ to whitelist = request.log*$ to match the naming convention.
Still no luck

0 Karma

ddrillic
Ultra Champion

-- Log files name format within /web (4 months worth, but i only need 7 days):

That goes to best practices of the log directories and archiving. From Splunk perspective, it would be much better if this directory structure contains *only * the 7 days of data. The rest of the files should be moved to an archive area. If possible.

Sifting through a large directory structure and identifying the files to monitor is expensive and the software doesn't give you enough indications where it stands when it processes this directory, so we are in the dark.

0 Karma

woodcock
Esteemed Legend

You have told it to search for infinite depth and if you have many subdirectories, Splunk can get WAY too busy. Change it to this:

 [monitor:///logs/sam/ct/sact0*/*/web]
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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