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!

Prove Your Splunk Prowess at .conf25—No Prereqs Required!

Your Next Big Security Credential: No Prerequisites Needed We know you’ve got the skills, and now, earning the ...

Splunk Observability Cloud's AI Assistant in Action Series: Observability as Code

This is the sixth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Answers Content Calendar, July Edition I

Hello Community! Welcome to another month of Community Content Calendar series! For the month of July, we will ...