I would like to set up a Python script input which will output a .csv file. This .csv file will be the data input for my index.
Further, i would want the dashboard to search only the latest data generated by the script. Can you please guide me on how to go about this? I'm using a Windows machine and would prefer to use the Python interpreter present on my Windows machine.
You should develop your script using the python interpreter that ships with Splunk. That's the one that Splunk will use to run your script.
Have the script write the CSV file to your app's lookups directory ($SPLUNK_HOME/etc/apps//lookups). Then your searches can use the inputlookup
command to get the data. One drawback to this approach is you will always have only the most recent data set - there's no going back in time to see how things changed.
Another approach is to have the script write the CSV file to a directory monitored by Splunk ([monitor:///path/to/file]
in inputs.conf). That will give you a new set of data every time your script runs. Dashboard searches would then need to use an appropriate SPL command to fetch only the latest data. For example, if your script runs every hour, then the search could specify earliest=-1h
to get only the last hour's data.
You should develop your script using the python interpreter that ships with Splunk. That's the one that Splunk will use to run your script.
Have the script write the CSV file to your app's lookups directory ($SPLUNK_HOME/etc/apps//lookups). Then your searches can use the inputlookup
command to get the data. One drawback to this approach is you will always have only the most recent data set - there's no going back in time to see how things changed.
Another approach is to have the script write the CSV file to a directory monitored by Splunk ([monitor:///path/to/file]
in inputs.conf). That will give you a new set of data every time your script runs. Dashboard searches would then need to use an appropriate SPL command to fetch only the latest data. For example, if your script runs every hour, then the search could specify earliest=-1h
to get only the last hour's data.