基本搜索不适用于图表面板
Base search is not working for Chart panel
我已经使用基本搜索创建了一个仪表板,如下所示。
基本搜索在 single
面板上正确应用,但在 chart
面板中基本搜索似乎不起作用。图表面板始终显示未找到结果。但是,如果我直接给出查询而不是引用基本搜索,那么图表面板也可以正常工作。
如何确保 chart
面板使用基本搜索?
<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>
timechart
命令需要 _time 字段,基本搜索不提供该字段。修复取决于时间戳字段的格式。如果它是纪元形式,那么图表面板中的简单 | rename timestamp as _time
就可以了;否则,必须使用 | eval _time = strptime(timestamp, "<format string>")
.
将时间戳转换为纪元形式
我已经使用基本搜索创建了一个仪表板,如下所示。
基本搜索在 single
面板上正确应用,但在 chart
面板中基本搜索似乎不起作用。图表面板始终显示未找到结果。但是,如果我直接给出查询而不是引用基本搜索,那么图表面板也可以正常工作。
如何确保 chart
面板使用基本搜索?
<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>
timechart
命令需要 _time 字段,基本搜索不提供该字段。修复取决于时间戳字段的格式。如果它是纪元形式,那么图表面板中的简单 | rename timestamp as _time
就可以了;否则,必须使用 | eval _time = strptime(timestamp, "<format string>")
.