如何将图表以及相应的搜索查询从splunk仪表板导出到pdf?

时间:2020-01-28 21:41:11

标签: splunk

我创建了一个仪表板,其中没有几个输入选择器和不同的面板。当我导出为PDF时,只会导出图表。我需要单击交互式图表右下角的“打开搜索”按钮以生成URL,然后将其导出为PDF。

如果可能的话,查询需要在splunk仪表板中不可见。

谢谢。

1 个答案:

答案 0 :(得分:0)

您可以在html面板中包含令牌的值,该面板可用于随后显示正在运行的查询。看下面的例子。

<form>
  <label>SO Test</label>
  <fieldset submitButton="true">
    <input type="text" token="idx">
      <label>Index</label>
      <default>*</default>
    </input>
  </fieldset>
  <row>
    <html>
      <pre>index=$idx$ | stats count by source</pre>
    </html>
  </row>
  <row>
    <panel>
      <chart>
        <search>
          <query>index=$idx$ | stats count by source</query>
          <earliest>-24h@h</earliest>
          <latest>now</latest>
          <sampleRatio>1</sampleRatio>
        </search>
        <option name="charting.chart">pie</option>
        <option name="charting.drilldown">none</option>
        <option name="refresh.display">progressbar</option>
      </chart>
    </panel>
  </row>
</form>

PDF screenshot

在您的情况下,您可能有多个面板,每个面板可能会有不同的查询。您可以使用多个html元素,也可以仅将令牌的值放在开头。