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!

Splunk Forwarders and Forced Time Based Load Balancing

Splunk customers use universal forwarders to collect and send data to Splunk. A universal forwarder can send ...

NEW! Log Views in Splunk Observability Dashboards Gives Context From a Single Page

Today, Splunk Observability releases log views, a new feature for users to add their logs data from Splunk Log ...

Last Chance to Submit Your Paper For BSides Splunk - Deadline is August 12th!

Hello everyone! Don't wait to submit - The deadline is August 12th! We have truly missed the community so ...