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!

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

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco + Splunk! We’ve ...

AI Adoption Hub Launch | Curated Resources to Get Started with AI in Splunk

Hey Splunk Practitioners and AI Enthusiasts! It’s no secret (or surprise) that AI is at the forefront of ...