Splunk Dev

Report export - feed a Word Template

splunk_zen
Builder

My boss has to periodically send about 50 different .docx reports with our systems monthly events and performance details to some clients.

I thought about mapping each Splunk Dashboard unique image IDs to a custom .docx template with image placeholders and calling PyWin32 (or python-docx) to insert those images, replacing each placeholder with the corresponding image.

Thing is, do the Dashboard images have unique IDs?

Does Splunk allow exporting those images this way?
This can be a eliminating factor deciding between Splunk and a (in my opinion much inferior) tool some other company is trying to sell us.

0 Karma
1 Solution

johandk
Path Finder

I don't think what your suggesting is possible. Splunk doesn't display graphs as images. In the 4.2 & previous versions it was a flash component and that has now been replaced by javascript in 4.3

I had a similar requirement and eventually decided to use the REST API to fetch data and generate the graphs & docs. Works like a charm.

The Python (or Java/JavaScript) SDK which handles communication with Splunk makes this pretty easy to accomplish. Combine that with matplotlib (http://matplotlib.sourceforge.net/) and you've got a robust solution.

http://docs.splunk.com/Documentation/Splunk/latest/Developer/RESTIntro
https://github.com/splunk/splunk-sdk-python

View solution in original post

johandk
Path Finder

I don't think what your suggesting is possible. Splunk doesn't display graphs as images. In the 4.2 & previous versions it was a flash component and that has now been replaced by javascript in 4.3

I had a similar requirement and eventually decided to use the REST API to fetch data and generate the graphs & docs. Works like a charm.

The Python (or Java/JavaScript) SDK which handles communication with Splunk makes this pretty easy to accomplish. Combine that with matplotlib (http://matplotlib.sourceforge.net/) and you've got a robust solution.

http://docs.splunk.com/Documentation/Splunk/latest/Developer/RESTIntro
https://github.com/splunk/splunk-sdk-python

splunk_zen
Builder

Thanks johandk.

0 Karma

johandk
Path Finder

Sorry can't share any code. I don't own it.

Essentially how you use matplotlib is up to you. I did use custom graph types and just parsed the data into the correct format using what I saw in the examples. That created a bunch of jpg's which then got imported into the docs via another internal system of ours.

Tip: There is an app called new_english which returns data from the Splunk API in JSON format rather than the horrible default XML. Much easier to work with.

splunk_zen
Builder

johandk, did you use matplotlib to solely plot line graphs over the extracted data or did you specify custom graph types depending on the source data?
Also, did you use PyWin32 or Openxmllib for the docs generation?
Is it possible for you to share some of that code?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...

Upgrade Prep for 10.4, Network Observability Deep Dives, and More from Splunk Lantern

Splunk Lantern is Splunk’s customer success center that provides practical guidance from Splunk experts on key ...

Splunk Developer Day announcements: AI agents, MCP tools, Forecasting, and Custom ...

Splunk Developer Day was packed with product and platform updates for developers building in the AI ...