[rrd-users] rrdgraph: Negative values with --logarithmic

Alex van den Bogaerdt alex at vandenbogaerdt.nl
Mon Oct 17 03:01:11 CEST 2016

> What I want to achieve (and what I think those other proponents also
> had in mind) is that I essentially have some of my data mirrored at
> the x-axis for better readability (don't draw two values on top of
> each other).
> For example I plot outgoing packets on my network as a positive values
> while I plot the incoming packets via CDEF:output=0,outputx,- as
> negative values.  So the outgoing rate is shown above the x-axis and
> the incoming rate below the x-axis.

So, what you want to show is the outcome of a normal logaritmic function,
but mirrored. Instead of a new function...

> To tame network spikes somewhat I want to change the graph mode to
> logarithmic.  This works for the positive values, but the negative
> values simply vanish.  I just want the same transormation that happens
> to the positive values applied 'mirrored' the the negative values.
> Think of something like a "display-logarithm" function defined like
> this:
> double disp_log(double y)
> {
> 	if (y == 0) {
> 		return 0;
> 	} else if (y > 0) {
> 		return log(y);
> 	} else {
> 		return -log(-y);
> 	}
> }
> While "-log(-y)" might look weird in a mathematical context I think that
> it makes sense in describing "do the same as for positive values, only
> in the other direction".

... can't you just use CDEF:mirrored=logresult,-1,* ?
Or am I missing something ?

More information about the rrd-users mailing list