Splunk Search

How to add a flat, single value line to a graph?

samwatson45
Path Finder

Is there any way I can manually add another line to a chart, which is just a single value that I can decide?

All I want to do is add a second line to a timechart, set to a specific value.

Tags (2)
0 Karma
1 Solution

niketn
Legend

@samwatson45, are you looking for something like below?

<YourcurrentSearchWithTimechart>
| eval threshold=<yourThresholdValue>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

View solution in original post

mayurr98
Super Champion

hey try this run anywhere XML for threshold and custom fieldcolor.

<dashboard>
  <label>Test</label>
  <row>
    <panel>
      <chart>
        <search>
          <query>index=_internal 
|  stats count by sourcetype 
|  eval threshold=20000</query>
          <earliest>-15m</earliest>
          <latest>now</latest>
        </search>
        <option name="charting.chart">line</option>
        <option name="charting.drilldown">none</option>
        <option name="charting.fieldColors">
  {"count": 0xFF0000, "threshold": 0xFF9900}
</option>
      </chart>
    </panel>
  </row>
</dashboard>

For more info, have a look at this Specify custom colors for fields in charts

You can use | eval threshold=<int> to create a flat line on the chart and to give custom color to this or any field. you can make use of <option name="charting.fieldColors">{"count": 0xFF0000, "threshold": 0xFF9900}</option> where count and threshold are fieldnames with corresponding custom color in hex.

let me know if this helps!

0 Karma

samwatson45
Path Finder

That's very simple, thank you so much!

0 Karma

niketn
Legend

@samwatson45, are you looking for something like below?

<YourcurrentSearchWithTimechart>
| eval threshold=<yourThresholdValue>
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"

samwatson45
Path Finder

Perfect that works brilliantly! Thank you.
Is there an easy way to custom change the line colour?

0 Karma

niketn
Legend

I have converted my comment to answer. Please Accept if your issue is resolved!

You can use Simple XML Chart Configuration charting.fieldColors if you know the field names. Or else you can use charting.seriesColors if all fields appear in same sequence and are always present. Refer to documentation: https://docs.splunk.com/Documentation/Splunk/latest/Viz/ChartConfigurationReference#General_chart_pr...

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

samwatson45
Path Finder

Thanks a lot, have done!

0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...