All Apps and Add-ons

How to make Sideview Utils Redirector module use a dynamic URL

responsys_cm
Builder

I'm using a tabs module to show different parts of an upstream search. I would like users to be able to click on a row and open up an external URL. The URL opened will depend on the tab the user is clicking on.

Thx.

Craig

caseypike
Path Finder

I am having the same problem as responsys_cm... was there a solution?

"The only problem I'm having is that the redirector is adding a trailing "?" at the end of the URL. That's screwing up one of the redirects because there is already a "?" in the URL."

0 Karma

sideview
SplunkTrust
SplunkTrust

Note - Sideview Utils 2.2 was just released, and the aforementioned fix to Redirector was included. You can read the release notes and download the new version by following the links on this page: http://sideviewapps.com/apps/sideview-utils/

0 Karma

sideview
SplunkTrust
SplunkTrust

The bug will be fixed in Sideview Utils 2.2, which will be out next week. Until then I'm afraid the only workaround is to try and get all the args corralled into arg.* params, and leave the url param holding only the url with no querystring arguments.

0 Karma

sideview
SplunkTrust
SplunkTrust

Yep, you can. It's a bit of a ride.

First though, the Redirector module can always include dynamic URL's just by having

<param name="url">$someDynamicKey$</param>

or

<param name="url">http://google.com?q=$someDynamicKey$</param>

The delicacy here is that you're almost certainly using the selected key from the Tabs module already, so you'll need to use the selected key from the Tab to specify two things; whatever you were using it for already, plus the new URL.

This is totally possible.

The short short version is that you have the Tabs module output both keys as its value, with the two values separated by a separator that you choose, commonly ",". Then you use a ValueSetter to split them up into the N different values that can each be references separately downstream from that ValueSetter.

How you configure the Tabs module, whether it's statically or dynamically, is almost identical to how you configure the Pulldown module. (You can think of a Tabs module as a Pulldown module that's decided to disguise itself as a set of tabs, if it helps).

This is fortunate because it means you can crib very heavily from the equivalent Pulldown example in the docs. Go to the documentation embedded in the Sideview Utils app, "Module Reference > Pulldowns > Setting more than one value".

In that view, obviously it's an example of a Pulldown config, but from the extreme similarity of Pulldown with Tabs, you can change the Pulldown to a Tabs, remove the "label" param and it's otherwise identical.

As far as writing up a direct answer for you using Tabs though, here's one.

<module name="Tabs">
 <param name="name">selectedTab</param>
  <param name="staticTabs">
    <list>
      <param name="label">Tab One</param>
      <param name="value">firstKeyValue,http://google.com/my_first_url</param>
    </list>
    <list>
      <param name="label">Tab Two</param>
      <param name="value">secondKeyValue,http://google.com/my_first_url</param>
    </list>

    <module name="ValueSetter">
      <param name="name">systemAndUrlPair</param>
      <param name="delim">,</param>
      <param name="value">$selectedTab$</param>

      <!-- at this level and downstream you can get the current selected 
           firstKeyValue/secondKeyValue value as   
           $systemAndUrlPair[0]$

           and you can get the selected URL as 
           $systemAndUrlPair[1]$
           to use in your Redirector module.

           -->

But I still encourage you to read about the "Module Reference > Pulldowns > Setting more than one value" docs page, and actually to work through all of the Pulldown docs because you'll pick up several useful best-practice things, and again the Tabs module is just like the Pulldown so any nice conveniences that Pulldown has are almost certainly available with Tabs as well.

sideview
SplunkTrust
SplunkTrust

The answer really is that the value in the Tabs module cannot contain the $click.fields.foo$ token, at all. Instead work it out so that both the Tabs module's $selectedUrl$ key AND the $click.fields.foo$ key, are in the Redirector module somewhere.

Also, if you're adding args using the arg.* params, then don't also add args to the 'url' param because you'll hit a bug that wont be fixed until 2.2 comes out (next week). For now try and just let the URL be the straight URL with no args, and let the arg.* params carry all the args.

0 Karma

responsys_cm
Builder

Thanks again for all your help, Nick. One question... If the URL that I set in the tabs module is going to contain the value of one of the fields on the row that is clicked on, do I put $click.fields.foo$ in the URL?

0 Karma

responsys_cm
Builder

I'll try that approach later. For now, I just created the URL using eval, passed that to a ResultsValueSetter, and then to the Redirector.

The only problem I'm having is that the redirector is adding a trailing "?" at the end of the URL. That's screwing up one of the redirects because there is already a "?" in the URL.

0 Karma

sideview
SplunkTrust
SplunkTrust

Well, because you have commas in the search syntax you'll want to use some other character besides "," as your delim, but basically yea. Pick some char you're not using as your delim, like ";"

0 Karma

responsys_cm
Builder

I currently have a search string in the value param for my tabs. Is it possible to have the search string followed by a comma and then the url?

<param name="staticTabs">
<list>
<param name="value">search NOT dest_port="None" | dedup dest,hostname,protocol,dest_port | sort dest,protocol,dest_port | table dest,hostname,protocol,dest_port | rename dest AS "IP", hostname AS "Hostname", domainname AS "Domain Name", protocol AS "Protocol", dest_port AS "Port"</param>
<param name="label">Open Ports</param>
</list>

0 Karma

sideview
SplunkTrust
SplunkTrust

Sure, you could. You would then use a ResultsValueSetter to pull the eval'ed field down from the search results so you could access it as $url$. However I still advise the Tabs/ValueSetter approach. ResultsValueSetter can be very powerful but it's a little messy to involve splunkd in what is essentially just client-side logic.

As to your second question, you shouldn't use $click.value$ anymore generally. See the docs on the "Key Techniques - Inline Drilldown", which will walk you through the new keys like $click.fields.YourFieldNameGoesHere$.

0 Karma

responsys_cm
Builder

Each of my tabs has a search that runs to filter down the results. Is it possible to just end each search with a | eval url="http://unique-url" and have that $url$ token available to the redirector later?

It also looks like the redirector is using the first field in the table for the $click.value$. How can I make that use a different field in the table?

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...