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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...