Refine your search:

Please refer to the code below. Instead of the value of $app$ (i.e. "App2") passed to the macro App1_Search_All_Logs, the string "$app$" is passed.

How do I get the linkSearch' param of the SingleValue module to listen to the addterm` intention above it?

<module name="StaticSelect" layoutPanel="panel_row1_col1_grp1">
    <param name="searchWhenChanged">True</param>
    <param name="selected">App2</param>
    <param name="settingToCreate">app_setting</param>
    <param name="label">App1 Server: </param>
    <param name="staticFieldsToDisplay">
        <list>
            <param name="label">App2</param>
            <param name="value">App2</param>
        </list>
        <list>
            <param name="label">App3</param>
            <param name="value">App3</param>
        </list>
    </param>
    <module name="ConvertToIntention">
        <param name="settingToConvert">app_setting</param>
        <param name="intention">
            <param name="name">stringreplace</param>
            <param name="arg">
                <param name="app">
                    <param name="value">$target$</param>
                </param>
            </param>
        </param>
        <module name="NullModule" layoutPanel="panel_row1_col1_grp2"/>
        <module name="TimeRangePicker" layoutPanel="panel_row1_col1_grp3">
            <param name="label">Time Range:</param>
            <param name="selected">Last 15 minutes</param>
            <param name="searchWhenChanged">True</param>
            <module name="ConvertToIntention">
                <param name="settingToConvert">series_setting</param>
                <param name="intention">
                    <param name="name">addterm</param>
                    <param name="arg">
                        <param name="series">$target$</param>
                    </param>
                </param>
                <module name="NullModule" layoutPanel="panel_row1_col2"/>
                <module name="NullModule" group="RT: total/site/slice" layoutPanel="panel_row2_col1">
                    <module name="NullModule" layoutPanel="panel_row2_col1_grp1">
                        <module name="HiddenSearch" autoRun="True">
                            <param name="search">index=summary summary_type=RSA_REQUEST app=rsafi | stats avg(respTime) as avg by app | `App1_Alert_AvgRt(avg, range)` | `App1_Alert_2_SV(range, sev)` | `App1_Round(avg, 0, " ms")`</param>
                            <module name="SingleValue">
                                <param name="field">avg</param>
                                <param name="classField">sev</param>
                                <param name="linkView">flashtimeline</param>
                                <param name="linkSearch">`App1_Search_All_Logs($app$,"...", ".")`</param>
                            </module>
                        </module>
                    </module>
                </module>
            </module>
        </module>
    </module>
</module>

asked 18 Dec '09, 00:10

jiuan's gravatar image

jiuan
614
accept rate: 0%

edited 27 Apr '10, 07:40

nick's gravatar image

nick ♦
14.2k1318


4 Answers:

Hey Jiuan. This can be done, but not this way. First let me try and clear up a couple things--

1) I think the second ConvertToIntention is just a copy and paste error from the example you were using? It will do nothing because it's converting a 'series_setting' key that nobody ever creates. Can you confirm that there's nothing that its supposed to be doing?

2) The 'linkSearch' param on SingleValue never effects the search that the SingleValue renders it's data from. Instead it provides a simple static way to override the search that will run when the user clicks on the link. The search that SingleValue renders from is just determined by the HiddenSearch above it, and any intentions that exist at that point. I have a feeling you may have drawn an understandable but incorrect conclusion as to what the linkSearch param does.

3) let me try and restate your goals from the user's perspective and see if that can shake anything out.

-- user selects an 'app' from the pulldown, or just leaves it at 'App2' which is the default.

-- user selects a timerange, or just leaves it at the default value.

-- Obviously i dont know what the macro's are doing but it seems fair to assume that they are presenting some overall metric of response time. The strange thing that leaps out is that you are running this search without using the user's selection of 'app'. is this intentional? I say this because if you look at the HiddenSearch module right above the SingleValue, there's no $app$ within the 'search' param there.

(Also while we're at it you're doing the stats by app, but the search clause before stats is deliberately narrowing the results to a single app='rsafi' which confuses me a little. At any rate since you're choosing to use the stringreplace intention and there's no $app$ in the search it'll just ignore it. )

-- when the user clicks on the link, now you want to do a different search. Although obviously it's going to be a 'related' search it could be completely different except a) you need it to now use the user's selection of 'app', and b) you need it to use the same timerange.

OK, those are the minor things. At least I think they're minor. =)

Bad news: SingleValue's linkSearch is a very simple, very static parameter and doesnt work this way at all im afraid. It's an optional parameter and if you use it, it overrides the default behaviour and just runs the string you gave it verbatim. There's no dynamic replacement. Hardly anything in 4.0.X actually does dynamic replacement of $foo$ tokens. Without radically digressing we do think about this a lot and it would be cool if in future versions you could re-use dynamic keys anywhere.

Good news: this is possible although i cant think of a way to put the link on the SingleValue module itself.

Again, i assume that you do not intend to use the user's selection for 'app', within the search that generates the average resp_time statistic, so im not doing it here either.

                    <module name="HiddenSearch">
                        <!-- deliberately rendering the SingleValue from a different search that does not consume the $app$ stringreplace intention, but does (implicitly) reuse the timerange -->
                        <param name="search">index=summary summary_type=RSA_REQUEST app=rsafi | stats avg(respTime) as avg by app | `App1_Alert_AvgRt(avg, range)` | `App1_Alert_2_SV(range, sev)` | `App1_Round(avg, 0, " ms")`</param>
                        <module name="SingleValue">
                            <param name="field">avg</param>
                            <param name="classField">sev</param>
                            <param name="linkView">flashtimeline</param>
                            <param name="linkSearch">`App1_Search_All_Logs($app$,"...", ".")`</param>
                        </module>

                        <!-- here though i define another search and it *does* consume the $app$ stringreplace intention. (and again it implicitly will pick up the time range)  -->
                        <module name="HiddenSearch">
                            <!--  since the stringreplace intention with the $app$ key is still there we can refer to it here and it'll be stitched into this search. -->
                            <param name="search">`App1_Search_All_Logs($app$,"...", ".")`</param>

                            <!--  and when the user clicks on the link they'll be redirected to flashtimeline to run the resulting search. See /en-US/modules#Splunk.Module.ViewRedirectorLink for more details on the params of this module -->
                            <module name="ViewRedirectorLink">
                                <param name="viewTarget">flashtimeline</param>
                                <param name="label">Check it out</param>
                            </module>
                        </module>
                    </module>
link

answered 28 Dec '09, 20:00

nick's gravatar image

nick ♦
14.2k1318
accept rate: 47%

The linkSearch parameter of the SingleValue module does not listen to the intention channel and so will not pick up an values that are being propagated in the tree. It is strictly a statically defined field that assumes that the click action always uses the same search.

I don't have a complete alternative solution, but one thing that may be workable in the meantime is to attach a ViewRedirectorLink module. If you augment this snippet:

<module name="HiddenSearch">
    <param name="search">FOO</param>
    <module name="SingleValue"></module>
</module>

to attach the ViewRedirectorLink module like:

<module name="HiddenSearch">
    <param name="search">FOO</param>
    <module name="SingleValue">
        <module name="ViewRedirectorLink">
            <param name="viewTarget">flashtimeline</param>
            <param name="label">View results</param>
        </module>
    </module>
</module>

then the result will be a new link 'View results' that appears underneath the single value module.
This link will simply resurrect the search FOO, so it will drop the user into a search result view that shows the underlying search that generated the SingleValue.

link

answered 23 Dec '09, 22:12

Johnvey's gravatar image

Johnvey ♦♦
2.2k1217
accept rate: 58%

The main developers for this are out; a better answer will appear next week.

(23 Dec '09, 22:12) Johnvey ♦♦

(from dcroteau): Thanks Johnvey....Before I try this, will ViewRedirectorLink take the value of "$app$"? $app$ is the results of a saved search. I understand about some of the Dev-s being out for the remainder of the week. Have a great holiday.

(28 Dec '09, 17:59) Johnvey ♦♦

No, ViewRedirectorLink also does not listen to those dynamic tokens.

(28 Dec '09, 18:00) Johnvey ♦♦

ViewRedirectorLink doesnt know about the token directly, but the HiddenSearch above it certainly does. Maybe look again at the code sample I posted - you can see im using the $app$ replacement in HiddenSearch, and then the HiddenSearch contains the ViewRedirectorLink. End result is what you want.

(05 Apr '10, 17:36) nick ♦

Can you please repost this with the "code sample" mode, and pasting in plain text? It's hard to know what you really entered. But when you pass a value of a variable into a macro, you do not surround it with $ signs, you simply pass in the value as it seems you're doing with the rest of the macros, e.g., probably it should just be:

| RSA_Search_All_Logs(app,"...",".")

(With the backticks, which I can't seem to get to display here.)

link

answered 18 Dec '09, 02:50

gkanapathy's gravatar image

gkanapathy ♦
26.2k1622
accept rate: 42%

(from Jiuan) Could you please refer to Case # 37344? The sample code is there. Meanwhile, I tried your suggestion above but in vain. The value of $app$ is not passed to the search macro.

(23 Dec '09, 20:19) Johnvey ♦♦

SingleValue

linkSearch = search terms

* Specify a valid complete search to turn the result into a clickable link.

So in Juian's example he is passing in the results called app, and the results do not show up as choices in the dropdown

link

answered 23 Dec '09, 18:17

davesplunkmonky's gravatar image

davesplunkmonky
611
accept rate: 0%

Post your answer
toggle preview

Follow this question

Log In to enable email subscriptions

RSS:

Answers

Answers + Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×323
×115

Asked: 18 Dec '09, 00:10

Seen: 889 times

Last updated: 27 Apr '10, 07:40

Copyright © 2005-2012 Splunk, Inc. All rights reserved.