|
Hi, I'm trying to add a drop down menu to a chart I have created on my dashboard but I can't seem to get it to work. The code for the chart on my dashboard is:
I'd like to add a drop down menu to this so that users can select the time span they would like for the search. The code I have for the drop down menu is:
I've tried inserting this before row and after row but I still can't seem to get it to show up or work. Is there something anyone notices out of the ordinary that I could be missing? |
|
The simplified XML uses the So in light of that, one thing to try is changing your search to
(Note the $timeSpan$ token now living in the timechart clause) An obvious problem with the stringreplace intention here is of course that the saved search will not function correctly outside of this one custom view. The $timeSpan$ argument will not get replaced when the search is run straight from the menu so it'll throw a search language syntax error. What you have to do then if you want that saved search to be both visible and functional, is to specify the search inline with I will try using the inline search and see if this works.
(21 Dec '10, 21:22)
gnovak
I tried putting this search directly in the dashboard xml but it threw an error. I had <searchstring>sourcetype="cron_BalanceEmail" (source="asia" OR source="info" OR source="org") starthoursago="120" BalanceEmail sent | rex field=_raw "[BalanceEmail] ?(?<totalemailssent>[d]+) of (?<totalemailstosend>[d]+) of email notification sent." | search TotalEmailsToSend="" OR TotalEmailsSent="" | timechart $timeSpan$ sum(TotalEmailsToSend) as TotalEmailsToSend sum(TotalEmailsSent) as TotalEmailsSent</searchstring> and it did not work. Also where do I put the code for the drop down?
(22 Dec '10, 20:28)
gnovak
When you say "use a different saved search that is configured with is_visible=False." what do you mean? Can you explain?
(22 Dec '10, 21:17)
gnovak
Also keep in mind that code for the drop down I "borrowed" from another example so the $timespan$ token i am not sure is relevant to the search or not. I was trying to find more data on what exactly to specify for a token but that info is sometimes hard to find.
(22 Dec '10, 21:20)
gnovak
I'm starting to wonder: do i have to make this entire dashboard advanced XML now to be able to add a drop down menu where the user can select the timerange for the search results?
(22 Dec '10, 21:40)
gnovak
You dont need a $foo$ token for the timeRange - it is handled in parallel with the search and as such does not appear in the search string. And it should work fine in the simplified XML to have both pulldowns but it's a pita to debug the simplified XML so I do recommend switching to the advanced XML. In the long run people find it easier to understand and deal with. And the token names themselves like '$timeSpan$' are meaningless - you can call it $monkey$ if you like.
(27 Dec '10, 22:24)
sideview ♦
And by 'use a different saved search that is configured with is_visible=False', Im just pointing out that if you need it to be a saved search for some reason, it'll have the $foo$ tokens in it. This means when people go and run the search from the saved search menu it wont work cause those $foo$ tokens will be searched on as literals. So you can have two copies of the saved search, and have the $foo$ one marked with is_visible=false such that it doesnt appear in the menu. hth
(27 Dec '10, 22:25)
sideview ♦
showing 5 of 7
show 2 more comments ▼
|
|
This is the xml that adds the time drop down menu and execute the new search when changed:
|
|
This actually works if I make a new "view" or dashboard and put this code in it. However I am having issues trying to incorporate this code with my current dashboard. At some point the view shows up as "None" in the views menu and when I click it I get an error. I'm still looking into this but not sure why it's doing this. I had to take out <dashboard> from the top of the code and </dashboard> from the bottom of the code.
(29 Dec '10, 16:32)
gnovak
|
Also here is the search as well: sourcetype="cron_BalanceEmail" (source="asia" OR source="info" OR source="org") starthoursago="120" BalanceEmail sent | rex field=_raw "[BalanceEmail] ?(?<totalemailssent>[d]+) of (?<totalemailstosend>[d]+) of email notification sent." | search TotalEmailsToSend="" OR TotalEmailsSent="" | timechart sum(TotalEmailsToSend) as TotalEmailsToSend sum(TotalEmailsSent) as TotalEmailsSent