Hi everyone,
In my script, I am using the /services/pdfgen/render/ endpoint to export the views I want. However, I would like to attach a static custom logo to the PDF header through the endpoint parameter (or something similar). I could not do it in the Email Settings because that will override the custom logo set for the whole Splunk environment (i.e. other apps).
My question, is there anywhere I can find the parameters list for the endpoint? Any advice would be much appreciated.
Thanks!!
As far as I know there is no official documentation on pdfgen/render arguments.
You could take a look at the $SPLUNKHOME/etc/system/bin/pdfgen_endpoint.py file, where the class PDFGenHandler is defined. As the name says, it handles requests to the pdfgen endpoint.
There are a bunch of variables with names like ARG_INPUT_DASHBOARD or similar that define the names of supported arguments. You can see the usage of some of these arguments in the answer to this question: Can I Export PDF via REST?
https://answers.splunk.com/answers/223655/can-i-export-pdf-via-rest.html
There is apparently an "include-splunk-logo" argument which as far as I can see only takes a boolean value, so you can't give it a different logo. But at least you can turn off the splunk logo if that's enough for your case.
I'm not familiar with the Email Settings but shouldn't you be able to make any settings app-only, e.g. only set a custom logo for a certain app through Email Settings?
As far as I know there is no official documentation on pdfgen/render arguments.
You could take a look at the $SPLUNKHOME/etc/system/bin/pdfgen_endpoint.py file, where the class PDFGenHandler is defined. As the name says, it handles requests to the pdfgen endpoint.
There are a bunch of variables with names like ARG_INPUT_DASHBOARD or similar that define the names of supported arguments. You can see the usage of some of these arguments in the answer to this question: Can I Export PDF via REST?
https://answers.splunk.com/answers/223655/can-i-export-pdf-via-rest.html
There is apparently an "include-splunk-logo" argument which as far as I can see only takes a boolean value, so you can't give it a different logo. But at least you can turn off the splunk logo if that's enough for your case.
I'm not familiar with the Email Settings but shouldn't you be able to make any settings app-only, e.g. only set a custom logo for a certain app through Email Settings?
So I know this is over 5 years old, but I recently had to hack my way around the pdfgen/render enpoint again and I finally figured out how to set a custom logo for a single report without having to fiddle with Email Settings.
The endpoint allows you to override the pdf-Settings using the HTTP arguments. This includes the parameter pdf.logo_path.
Example:
Assuming you're using python and splunk.rest.simpleRequest, and you've got a logo.png file in your apps appserver/static folder, you would do the following:
params = {
"include-splunk-logo" : 1,
"pdf.logo_path" : "myapp:logo.png",
... any other parameters ...
}
response, content = splunk.rest.simpleRequest("https://your-splunk:8089/services/pdfgen/render", method="GET", getargs=params)
Obviously this works with any other way of issuing HTTP requests.
I hope this helps anyone with that particular problem.
Thanks! That's what I'm looking for. Regarding the Email Settings, unfortunately, I tried it and it just set for for the whole environment (even I did it through app conf files). I will have a deeper look into the file you suggested now. Cheers