
Working on the Splunk OEM team, we are often asked if it is possible to replace the logo printed on PDF reports. The short answer is yes, it is possible but it is kind of a hack. The workaround would not be Splunk upgrade safe, there are some limitations to what the SVG can do, and you would need to edit some Python. With that being said, the request to make this easier is already in the laundry list of improvements we are looking at for PDF printing.
Let’s get started:
- The default Splunk logo is hardcoded in the $SPLUNK_HOME/lib/python2.7/site-packages/splunk/pdf/pdfrenderer.py file. Make sure you backup the file before editing!
- At the bottom of the file, you will notice a variable called _splunkLogoSvg.
- The variable contains XML data for your logo.
- Here is my sample XML for creating a simple green circle logo:
# _splunkLogoSvg # this is the hard-coded splunk logo _splunkLogoSvg = """ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="75" y="25" width="87" height="26" viewBox="0 0 263 78" enable-background="new 0 0 263 78" xml:space="preserve"> <g transform="scale(***logoTransformSize***)"> <g> <circle cx="0" cy="0" r="50" stroke="black" stroke-width="3" fill="green" /> </g> </g> </svg> """
I know, I know – my SVG logo is ugly, but this should at least point you in the right direction.
Hopefully this was usefully and as always, Happy Splunking!
----------------------------------------------------
Thanks!
Karandeep Bains