Splunk Dev

Where does Splunk store output of Python script?

mrrci
Explorer

Hey there Splunk community. I'm new here and I would appreciate some help if it is possible.

I wrote a Python script that generates a XML file when you run it. However, when I run it through Splunk I don't get the generated XML files as I usually do (when I run it in the console) in the same folder where the script is located.

Where do those XML files go? I can't find them,

Thanks!

Labels (2)
Tags (3)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

We need more information.  How is the XML file created?  How is the file path specified?  How is the file populated?  Do you see any errors in Splunk's python.log file?

---
If this reply helps you, Karma would be appreciated.
0 Karma

mrrci
Explorer

It is created with Element Tree module in Python. Usually, when you run it from a console (I personally use Visual Studio Code), the XML file is written/generated in the same folder as the script itself (.py). Although, when I put the script in "/opt/splunk/etc/apps/myapp/bin" folder and run it with Splunk, the script is running but the XML file is not generated.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Please elaborate on "run it with Splunk" and say what you found in python.log.

---
If this reply helps you, Karma would be appreciated.

mrrci
Explorer

By "Run with Splunk" I mean to run as a custom scripted input (settings > data inputs > scripts). I'm not sure where to find python.log.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The python log is at $SPLUNK_HOME/var/log/splunk/python.log.  Or, in SPL, index=_internal source=*python.log

---
If this reply helps you, Karma would be appreciated.
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...