All Apps and Add-ons

passing 2 values through side view HTML panel

smolcj
Builder

Hi,
as in side view redirector module

  something   anything

how can we pass variables like this with side view html panel, one value to the flashtimeline search bar, other one to the text box created in the flashtimeline
Thank you
Please help

1 Solution

sideview
SplunkTrust
SplunkTrust

Well flashtimeline is a Splunk view, so the links that go to flashtimeline follow Splunk's permalink conventions, which are a little different from the conventions Sideview Utils brings.

A typical Sideview page link (meaning links to pages that have a Sideview URLLoader module, downstream from which are one or more Sideview TextField, Pulldown, Checkbox, Filters modules and/or Splunk SearchBar/TimeRangePicker modules) will look like:

?status=404&username=mildred&earliest=1357545600&latest=1360214239&autoRun=True

whereas a typical Splunk permalink, or at least a Splunk permalink to the flashtimeline view will look like:

?q=search%20status%3D404%20username%3Dmildred&earliest=1357545600&latest=1360214239

Breaking down the difference, the flashtimeline URL structure expects one big search string as it's "q" argument, and then you can pass earliest and latest as your timerange, and that's it. (or instead of "q" you can pass "s" as a savedsearch name, or sid as a job id, but I digress).

So you can absolutely use the Sideview Redirector module to redirect to flashtimeline, OR the Sideview HTML module to create simple links to flashtimeline. You just have to end up with the URL in the right form that the flashtimeline view expects.

Speaking just of the use of the HTML module to make such a dynamic link -- So step 1 is to make the search, and step 2 is to url-encode the key.

The Sideview ValueSetter module can help with step 2, and the Sideview HTML module can easily dispense with part 1.

<module name="ValueSetter">
  <param name="name">appropriatelyEncodedQuerystring</param>
  <param name="value">q=search $search$&amp;earliest=$search.timeRange.earliest$&amp;latest=$search.timeRange.latest$</param>
  <param name="urlEncodeKeys">search,search.timeRange.earliest,search.timeRange.latest</param>
  <module name="HTML">
    <param name="html"><![CDATA[
      <a href="flashtimeline?$appropriatelyEncodedQuerystring$">view search in flashtimeline</a>
    ]]></param>
  </module>
</module>

And just for completeness, the same thing with a Redirector module (and say a Button for the user to click) would look like:

<module name="Button">
  <param name="label">view in flashtimeline</param>
  <module name="ValueSetter">
    <param name="name">appropriatelyEncodedSearch</param>
    <param name="value">search $search$</param>
    <param name="urlEncodeKeys">search</param>
    <module name="Redirector">
      <param name="url">flashtimeline</param>
      <param name="arg.q">$appropriatelyEncodedSearch$</param>
      <param name="arg.earliest">$search.timeRange.earliest$</param>
      <param name="arg.latest">$search.timeRange.latest$</param>
    </module>
  </module>
</module>

View solution in original post

sideview
SplunkTrust
SplunkTrust

Well flashtimeline is a Splunk view, so the links that go to flashtimeline follow Splunk's permalink conventions, which are a little different from the conventions Sideview Utils brings.

A typical Sideview page link (meaning links to pages that have a Sideview URLLoader module, downstream from which are one or more Sideview TextField, Pulldown, Checkbox, Filters modules and/or Splunk SearchBar/TimeRangePicker modules) will look like:

?status=404&username=mildred&earliest=1357545600&latest=1360214239&autoRun=True

whereas a typical Splunk permalink, or at least a Splunk permalink to the flashtimeline view will look like:

?q=search%20status%3D404%20username%3Dmildred&earliest=1357545600&latest=1360214239

Breaking down the difference, the flashtimeline URL structure expects one big search string as it's "q" argument, and then you can pass earliest and latest as your timerange, and that's it. (or instead of "q" you can pass "s" as a savedsearch name, or sid as a job id, but I digress).

So you can absolutely use the Sideview Redirector module to redirect to flashtimeline, OR the Sideview HTML module to create simple links to flashtimeline. You just have to end up with the URL in the right form that the flashtimeline view expects.

Speaking just of the use of the HTML module to make such a dynamic link -- So step 1 is to make the search, and step 2 is to url-encode the key.

The Sideview ValueSetter module can help with step 2, and the Sideview HTML module can easily dispense with part 1.

<module name="ValueSetter">
  <param name="name">appropriatelyEncodedQuerystring</param>
  <param name="value">q=search $search$&amp;earliest=$search.timeRange.earliest$&amp;latest=$search.timeRange.latest$</param>
  <param name="urlEncodeKeys">search,search.timeRange.earliest,search.timeRange.latest</param>
  <module name="HTML">
    <param name="html"><![CDATA[
      <a href="flashtimeline?$appropriatelyEncodedQuerystring$">view search in flashtimeline</a>
    ]]></param>
  </module>
</module>

And just for completeness, the same thing with a Redirector module (and say a Button for the user to click) would look like:

<module name="Button">
  <param name="label">view in flashtimeline</param>
  <module name="ValueSetter">
    <param name="name">appropriatelyEncodedSearch</param>
    <param name="value">search $search$</param>
    <param name="urlEncodeKeys">search</param>
    <module name="Redirector">
      <param name="url">flashtimeline</param>
      <param name="arg.q">$appropriatelyEncodedSearch$</param>
      <param name="arg.earliest">$search.timeRange.earliest$</param>
      <param name="arg.latest">$search.timeRange.latest$</param>
    </module>
  </module>
</module>

smolcj
Builder

Thanks Nick, you are simply awesome !!!!!!!!!!!!!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

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