Getting Data In

How to develop a regular expression for my file paths to update in transforms.conf?

cleelakrishna
Loves-to-Learn

How to develop a regular expression for the below paths to update in transforms.conf?

/srv/tomcat7/iiq/logs/sailpoint.log
/srv/tomcat7/iiq/logs/localhost_access_log.2017-04-19.txt
/srv/tomcat7/iiq/logs/catalina.out

0 Karma

Richfez
SplunkTrust
SplunkTrust

cleelakrishna,

If one of the below answers resolved your issue, could you please mark it Accepted? If they both did, Accept the most useful of the answers and upvote the other!

If it did not, please post back with more information or what's not working right so we can help finish this up!

Happy Splunking,
Rich

0 Karma

woodcock
Esteemed Legend

In props.conf:

[YourSourcetypeHere]
REPORT-filename_from_source = filename_from_source

In transforms.conf:

[filename_from_source]
SOURCE_KEY = source
REGEX = [^\\\/]+$
FORMAT = finename::$1
0 Karma

somesoni2
Revered Legend

What you want to do with these path in the transforms.conf? Search time or index time?

0 Karma

cleelakrishna
Loves-to-Learn

there is one entry defined for log inputs. this happens to resolve to (at least) 6 different source files. Each unique file type should have a sourcetype, however these are all assigned to a single sourcetype.

I have to create each source type for that source paths

0 Karma

jkat54
SplunkTrust
SplunkTrust

If you're looking to capture the filenames, try this

 \/src\/tomcat7\/iiq\/logs\/(.*)

Or if you're extracting as a field

 \/src\/tomcat7\/iiq\/logs\/(?<fileName>.*)
Get Updates on the Splunk Community!

Enterprise Security Content Update (ESCU) | New Releases

In December, the Splunk Threat Research Team had 1 release of new security content via the Enterprise Security ...

Why am I not seeing the finding in Splunk Enterprise Security Analyst Queue?

(This is the first of a series of 2 blogs). Splunk Enterprise Security is a fantastic tool that offers robust ...

Index This | What are the 12 Days of Splunk-mas?

December 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...