All Apps and Add-ons

htm link to display/download xml-field

sbsbb
Builder

I have a field "xml", with the content of an xml-file...
I want to make a link, so that it is opening a new windows, with the xml-content in it.

In fact sideview already do this, but only for the module code :
http://splunk:8000/en-US/custom/sideview_utils/view/show?app=sideview_utils&view=pulldown4_dynamic_p...

1 Solution

sideview
SplunkTrust
SplunkTrust

There are two ways broadly speaking.

The first is to do what the Sideview Utils app does - basically write
a custom controller in python. It would be a completely different
custom controller than the Sideview one, because the Sideview one only
knows how to go get the XML source of a Splunk view and display it.
But basically you would use a Redirector module to pass appropriate arguments to the controller and it would display the XML field. Probaby easiest arguments to pass are the existing searchid $results.sid$, and the offset of the given row, and the field name.

The other way is to write custom javascript. You would open a new
window when the element is clicked but then our javascript would immediately rewrite the HTML contents of that window so that it displayed the XML string.

I delayed responding thinking I might have time to post specifics illustrating the second
way, or that I might think of a way to do it without any custom code. Sorry but I don't think I have time to make a working prototype for you.

View solution in original post

0 Karma

sideview
SplunkTrust
SplunkTrust

There are two ways broadly speaking.

The first is to do what the Sideview Utils app does - basically write
a custom controller in python. It would be a completely different
custom controller than the Sideview one, because the Sideview one only
knows how to go get the XML source of a Splunk view and display it.
But basically you would use a Redirector module to pass appropriate arguments to the controller and it would display the XML field. Probaby easiest arguments to pass are the existing searchid $results.sid$, and the offset of the given row, and the field name.

The other way is to write custom javascript. You would open a new
window when the element is clicked but then our javascript would immediately rewrite the HTML contents of that window so that it displayed the XML string.

I delayed responding thinking I might have time to post specifics illustrating the second
way, or that I might think of a way to do it without any custom code. Sorry but I don't think I have time to make a working prototype for you.

0 Karma

sbsbb
Builder

Thx.
It sound complicated for my know-how level... I hope I can achieve it or let it developp by so...

Do you can tell me a "Controller" name, I can look at in Splunk, to have an example ?

I've found http://davidwalsh.name/downloadify that seems to do at least a part of the job... in case of a js workaround

0 Karma

sbsbb
Builder

Hi, could you find something about that ?

0 Karma

sbsbb
Builder

Yes thats exactly what I want, having a new window displaying xml from on field...

0 Karma

sideview
SplunkTrust
SplunkTrust

Oh I see! You want the XML content to be displayed in the new window. Yes this can be done. I'll try and post an answer soon.

0 Karma

sideview
SplunkTrust
SplunkTrust

Can you clarify your question? It's not entirely clear what you're asking. Do you want to make a simple link or do you want to make a clickable table? When the user clicks this you want to pass the string value of your xml field, but do you want to pass it to another view or to another web based application? by module code do you mean the Splunk view XML?

0 Karma
Get Updates on the Splunk Community!

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

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 ...