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

Quantify Your Splunk Investment Impact: Introducing Savings Metrics to Value Insights

Building on the foundation established in our initial Value Insights releases, we are introducing the Savings ...

Event Series: Telemetry Pipeline Management

Balancing Scale and Spend: Gaining Control Over High-Volume Metrics in Splunk Observability Cloud As ...

Kick the Tires Before You Commit: A Hands-On Tour of the Splunk Observability Cloud ...

Evaluating an enterprise observability platform usually goes like this: fill out a form, get a free trial with ...