Developing for Splunk Enterprise

Report export - feed a Word Template

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

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

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

Builder

Thanks johandk.

0 Karma

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.

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