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
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...