Reporting

Scheduled PDF Delivery to file or folder not via email

rfds
Path Finder

Hi,

I've got some saved searches scheduled to output CSV files using the outputcsv command which works well. From there I run a script to upload the CSV file to an SFTP server.

I'd like to do something similar with the PDF output from a Dashboard. I have Scheduled PDF Delivery via email but I'm wondering if there is a way to get the PDF output to a file rather than sent via email?

Thanks!

Tags (1)

jhedgpeth
Path Finder

I couldn't find any answers either, just dead ends. I got a big hammer and crammed this into the pdf generator script at /opt/splunk/etc/system/bin/pdfgen_endpoint.py (5.0.7)
I'm sure this could be embellished to generate unique filenames, trigger some process, etc., but this was more of a proof-of-concept for me.

def _respond(self):
    # save and write out the file
    try:
        pdfsave = open('/some/path/to/myreport.pdf', 'w')
        pdfsave.write(self._pdfBuffer.getvalue())
        pdfsave.close()
        self.response.write(self_pdfBuffer.getvalue())
        ...

I added the three "pdfsave" lines, everything else is original script.

also, I would not recommend doing it how I did it unless you're desperate as it probably won't survive an upgrade, and may catch fire if taunted. however, it shows that splunk has the pdf file in an object just waiting to do all kinds of exciting things with. somebody who actually knew python could probably spend a couple hours and add some pretty useful features, imo.

rfds
Path Finder

Nice work! Thanks for the tip.

Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...