Splunk Search

Add a Line into a TimeChart

quatral
Explorer

Hi,

I'm trying to develop a TIMECHART that represent a Download/Upload bandtwidth from bandwidthd log. The TIMECHART should have total bandwidth for each months of the year and a line representing the limit per month.

I've try to make an EVAL that set a value to that limit, heres the code:

host="x" sourcetype="bandwidthd" | EVAL val_total_giga_bytes_limit=80 | EVAL val_total_giga_bytes_sent=cus_bndw_total_bytes_sent/1024/1024/1024 | TIMECHART SPAN=1month sum(val_total_giga_bytes_sent) AS "Giga-Octet envoyé" avg(val_total_giga_bytes_limit) AS "Limite"

The problem is, when I've got NULL value (on my test only September as events log), the "Limit" doesn't show properly.

Is there any options somewhere that could be done? I've tried in dashboard with the Null Value manage as zero but I just want the SUM to be at zero but the AVG still set at 80.

Sorry for my poor english skills.

Drew

Tags (1)
0 Karma
1 Solution

kristian_kolb
Ultra Champion

Have you tried fillnull (if your 'bad' events look like a= b= c= etc)

host="x" sourcetype="bandwidthd" 
| eval GB_limit=80 
| fillnull cus_bndw_total_bytes_sent
| eval GB_sent = cus_bndw_total_bytes_sent/1024/1024/1024 
| timechart span=1month sum(GB_sent) AS "Giga-Octet envoyé" avg(GB_limit) AS "Limite"

or if the 'bad' events look like a=NULL b=NULL etc, then use

replace NULL with 0 in cus_bndw_total_bytes_sent

instead of fillnull

http://docs.splunk.com/Documentation/Splunk/4.3.4/SearchReference/Replace
http://docs.splunk.com/Documentation/Splunk/4.3.4/SearchReference/Fillnull

Hope this helps,

Kristian

View solution in original post

kristian_kolb
Ultra Champion

Have you tried fillnull (if your 'bad' events look like a= b= c= etc)

host="x" sourcetype="bandwidthd" 
| eval GB_limit=80 
| fillnull cus_bndw_total_bytes_sent
| eval GB_sent = cus_bndw_total_bytes_sent/1024/1024/1024 
| timechart span=1month sum(GB_sent) AS "Giga-Octet envoyé" avg(GB_limit) AS "Limite"

or if the 'bad' events look like a=NULL b=NULL etc, then use

replace NULL with 0 in cus_bndw_total_bytes_sent

instead of fillnull

http://docs.splunk.com/Documentation/Splunk/4.3.4/SearchReference/Replace
http://docs.splunk.com/Documentation/Splunk/4.3.4/SearchReference/Fillnull

Hope this helps,

Kristian

quatral
Explorer
  • replace all the GB_limit = 1 by 80
0 Karma

quatral
Explorer

Hi Kristian, the problem is not the cus_bndw_total_bytes_sent but the GB_limit (in your exemple). I'm making a timechart for a year but I only have data for two months. I want GB_limit to be at 80 for all the 12 months even if there is no data loged.

host="x" sourcetype="y"
| EVAL GB_limit = 1
| FILLNULL GB_limit = 1
| EVAL GB_sent = cus_bndw_total_bytes_sent/1024/1024/1024
| FILLNULL GB_sent
| TIMECHART SPAN=1month SUM(GB_sent) AS "Giga-Octet envoyé" AVG(GB_limit) AS "Limite"

but I got a "Error in 'fillnull' command: Invalid argument: '='".

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...

SplunkTrust Application Period is Officially OPEN!

It's that time, folks! The application/nomination period for the 2026-2027 SplunkTrust is officially open. If ...