diff --git a/src/collectd.conf.in b/src/collectd.conf.in index f99955402d..15bb7cffd6 100644 --- a/src/collectd.conf.in +++ b/src/collectd.conf.in @@ -2047,6 +2047,10 @@ # # +# +# Format "Graphite" +# + # # # Host "localhost" diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index 98378b35bb..e9f6a5ac4c 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -10936,7 +10936,7 @@ This plugin supports two output formats: I and I. Synopsis: - Format Graphite + Format "Graphite" =over 4 diff --git a/src/write_log.c b/src/write_log.c index 31183ebbf5..8b1c510ff0 100644 --- a/src/write_log.c +++ b/src/write_log.c @@ -55,10 +55,17 @@ static int wl_write_graphite(metric_family_t const *fam) { int status = format_graphite(&buf, m, prefix, suffix, escape_char, flags); if (status != 0) { ERROR("write_log plugin: format_graphite failed: %d", status); - } else { - INFO("%s", buf.ptr); + strbuf_reset(&buf); + continue; + } + + /* trim newlines emitted by format_graphite() */ + while (buf.pos > 0 && isspace(buf.ptr[buf.pos - 1])) { + buf.pos--; + buf.ptr[buf.pos] = 0; } + INFO("%s", buf.ptr); strbuf_reset(&buf); }