Base search is not working for Chart panel - splunk

I have created a dashboard with the base search as shown below.
The base search is applied correctly on single panel but in chart panel the base search does not seem to work. The chart panel always shows no result found. But if I give the query directly instead of referencing to base search then the chart panel also works fine.
How do I make sure that chart panel uses the base search?
<search id="base_search_app">
<query>index=something | table msg,timestamp</query>
<earliest>$time.earliest$</earliest>
<latest>$time.latest$</latest>
</search>
<fieldset submitButton="true" autoRun="true">
<input type="time" token="time">
<label>Time Picker</label>
<default>
<earliest>-15m</earliest>
<latest>now</latest>
</default>
</input>
</fieldset>
<row>
<panel>
<single>
<title>Total created</title>
<search base="base_search_app">
<query>| where like(msg, "%Invoked service%") | stats count</query>
</search>
<option name="colorMode">block</option>
<option name="drilldown">none</option>
<option name="rangeColors">["0x53a051","0x0877a6","0xf8be34","0xf1813f","0x006d9c"]</option>
<option name="underLabel">No idea when to use this</option>
<option name="useColors">1</option>
</single>
</panel>
</row>
<row>
<panel>
<chart>
<title>Customer response timeline</title>
<search base="base_search_app">
<query>| search msg="*something*" OR msg="*somethingelse*" | timechart count</query>
</search>
<option name="charting.chart">line</option>
<option name="charting.drilldown">none</option>
<option name="height">558</option>
<option name="refresh.display">progressbar</option>
</chart>
</panel>
</row>

The timechart command requires the _time field, which the base search does not provide. The fix depends on the format of the timestamp field. If it's in epoch form then a simple | rename timestamp as _time in the chart panel will do; otherwise, timestamp will have to be converted into epoch form using | eval _time = strptime(timestamp, "<format string>").

Related

Using stats with a base query

I am building a dashboard that uses a base query and then several panels use that query to display some data. A few of my panels do not show anything (No Result Found) . All of the panels that dont show any data use stats function. Here is my dashboard code -
<label>ZZ_Test</label>
<description>Test Playground</description>
<search id="mainData">
<query>
index="mydata"| eventstats max(_time) as maxTimestamp| where _time=maxTimestamp| search businessGroup IN ("*")
</query>
<earliest>$timeToken.earliest$</earliest>
<latest>$timeToken.latest$</latest>
</search>
<fieldset submitButton="false">
<input type="time" token="timeToken">
<label>timeToken</label>
<default>
<earliest>-24h#h</earliest>
<latest>now</latest>
</default>
</input>
</fieldset>
<row>
<panel>
<single>
<title>Total1</title>
<search base="mainData">
<query>stats sum("objects{}.count") as "Total"</query>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</single>
<single>
<title>Total2</title>
<search base="mainData">
<query>spath path="objects{}.count" output="Total"</query>
</search>
<option name="drilldown">none</option>
<option name="refresh.display">progressbar</option>
</single>
</panel>
</row>
</form>
Here are a couple of sample events -
[{
"businessGroup": "Sample1",
"objects": [
{
"count": 5
}
]
},
{
"businessGroup": "Sample2",
"objects": [
{
"count": 54
}
]
}
]
When i view this dashboard, i see Total2 populated, but Total1 shows no results found.
What am i missing ?
I suspect the stats command doesn't like field names in object format. Try renaming them to something simpler first.
<query>| rename "objects{}.count" as count | stats sum(count) as "Total"</query>
[EDIT]
Second suggestion. The "Total1" panel does not contain an spath command, unlike panel "Total2". Without spath the field being counted probably doesn't exist.

How to select the first option if the ID of the user who is viewing the component is not there? Vue

I have a select where I list sellers, the issue is that I have validated that when entering that component in the select I am automatically located, the problem is that I do not go out in that list so the select is empty instead of the first option.
Example
<select
v-model="filter_user"
class="pull-right float-right mr-2 btn btn-light btn-lg"
>
<!-- <option v-for="user in sales_man" :key="user.id" :value="user.id" >
{{ user.name }}
</option> -->
<option value="">All sales man</option>
<option value="3">sales man 3</option>
<option value="4">sales man 4</option>
<option value="7">sales man 7</option>
</select>
I leave the foreach that fills me the same options but commented, but to be understood I put them option 1 to 1, the issue that I am ADMIN so my ID is 1 and every time I enter that option I want to leave me in the first option to see all executives and not 1 specific, how could I do it and not show me the blank select?
Refer: option:selected
<option value="" selected>All sales man</option>

Change link href depending on drop-down value

I have a button witha a href link:
My button
Then I have 3 drop-down (select) inputs, lets call them A, B & C
Depending on what the users choose, I want the link to be changed as this
My button
All three drop-downs will be Required
Find the following snippet useful. Handle the default values for the query params.
<select id="a" onchange="changeUrl()">
<option value="a1">a1</option>
<option value="a2">a2</option>
</select>
<select id="b" onchange="changeUrl()">
<option value="b1">b1</option>
<option value="b2">b2</option>
</select>
<select id="c" onchange="changeUrl()">
<option value="c1">c1</option>
<option value="c2">c2</option>
</select>
<a id="test" href="mysite.com">My button</a>
<script>
function changeUrl(){
let url="mysite.com?a=";
let a= document.getElementById('a').value;
url+=a+"&b=";
let b=document.getElementById('b').value;
url+=b+"&c=";
let c=document.getElementById('c').value;
url+=c;
document.getElementById('test').href=url;
}
</script>
</body>

radio button in joomla 2.5 registration form

I've made a user profile plugin for Joomla 2.5 using this tutorial link
It works great, but I need the custom field that I added to be a radio button instead of text, because it's a "male/female' option.
Here is how it looks like in /plugins/user/profile10/profiles/profile.xml:
<field
name="gender"
type="text"
id="gender"
description="Male or Female?"
filter="string"
label="Male or Female?"
message="PLG_USER_PROFILE_FIELD_WEB_SITE_MESSAGE"
size="30"
/>
and plugins/user/profile10/profile10.xml:
<field name="register-require_gender" type="list"
description="Your gender"
label="Male or female?"
>
<option value="2">JOPTION_REQUIRED</option>
<option value="1">JOPTION_OPTIONAL</option>
<option value="0">JDISABLED</option>
</field>
I noticed the line type="text" but I'm not sure what I replace it for and where I place both options.
Does anyone know how to do it? Thanks in advance.
According to the Joomla documentation for Standard Form Field Types, you want to use the Radio type. In this case, type would be 'radio' and you would add options for each value specified.
This is the code that I've used:
<field
name="gender"
type="radio"
id="gender"
label="PLG_USER_TESTPROFILE_FIELD_GENDER_LABEL"
default="m">
<option value="m">Male</option>
<option value="f">Female</option>
</field>

WAP pages served from any web server?

Can wap pages be served on a regular web server? I have made a page with .wml extension and changed the mime type to php as i want to execute php on the page. The page looks fine on the handset but it will not display fields. Loading the page locally via a simulator has no problem. Here is the page, pretty simple stuff...
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="card1" title="Currency" newcontext="true">
<p>
Amount: <input format="N*M" name="amount" title="Amount:"/>
From: <select name="from" value="USD" title="From:">
<option value="DEM">German Mark</option>
<option value="FRF">French Franc</option>
<option value="FIM">Finnish Markka</option>
<option value="USD">US Dollar</option>
</select>
To: <select name="to" value="FIM" title="To:">
<option value="DEM">German Mark</option>
<option value="FRF">French Franc</option>
<option value="FIM">Finnish Markka</option>
<option value="USD">US Dollar</option>
</select>
<br/> = <u>$(conversion)</u>
<do type="accept" label="Calculate">
<go href="currency.wmls#convert('conversion','$(from)','$(to)',$(amount))"/>
</do>
<do type="help" label="Help">
<go href="#card1_help"/>
</do>
</p>
</card>
<card id="card1_help" title="Help">
<onevent type="onenterforward">
<go href="currency.wmls#getInfoDate('date')"/>
</onevent>
<p>
The currency rates were obtained from the Federal
Reserve Bank of New York on $(date).
<do type="prev" label="Back">
<prev/>
</do>
</p>
</card>
</wml>
Ok, cracked it, spoofed the mime type
header('Content-type: text/vnd.wap.wml');