Splunk Dev

How to pass a 'source path' to a script ?

jeswin96
Engager

I am monitoring a location in my system.Whenever there is any new file in the location,I call a script using unarchive command in props.conf .I want to pass the source path of the new file in the location to the script?

I am calling the script when there is a new file in my location using following configuration:

input.conf
[monitor://C:\location\*.*]
index=test

props.conf
[source::C:\\location\*.*]
invalid_cause=archive
unarchive_cmd = path_to_script\\scriptName.py

I know that I can pass arguments to script like following and access arguments as command line arguments in script:

props.conf
[source::C:\\location\*.*]
invalid_cause=archive
unarchive_cmd = path_to_script\\scriptName.py argument1 argument2

Please help me how to pass source path(the location of the new file,
which is triggering the call of script) to script.

Labels (1)
0 Karma
Get Updates on the Splunk Community!

Splunk App for Anomaly Detection End of Life Announcement

Q: What is happening to the Splunk App for Anomaly Detection?A: Splunk is officially announcing the ...

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...