summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e13fe5e)
raw | patch | inline | side by side (parent: e13fe5e)
author | ~/.gitconfig <moshe@forter.com> | |
Thu, 14 Aug 2014 14:37:10 +0000 (17:37 +0300) | ||
committer | ~/.gitconfig <moshe@forter.com> | |
Thu, 14 Aug 2014 14:37:10 +0000 (17:37 +0300) |
src/write_riemann.c | patch | blob | history |
diff --git a/src/write_riemann.c b/src/write_riemann.c
index 1ce6bfb410bb5274b5790be1bc3f1a11fdc1a700..a3b655a53384c0efcdc414891cc955fee8816b00 100644 (file)
--- a/src/write_riemann.c
+++ b/src/write_riemann.c
@@ -569,12 +569,21 @@ static Event *riemann_value_to_protobuf (struct riemann_host const *host, /* {{{
format_name (name_buffer, sizeof (name_buffer),
/* host = */ "", vl->plugin, vl->plugin_instance,
vl->type, vl->type_instance);
- if (host->always_append_ds || (ds->ds_num > 1))
+ if (host->always_append_ds || (ds->ds_num > 1)) {
+ if (host->prefix == NULL)
+ ssnprintf (service_buffer, sizeof (service_buffer),
+ "%s/%s", &name_buffer[1], ds->ds[index].name);
+ else
ssnprintf (service_buffer, sizeof (service_buffer),
"%s/%s/%s", host->prefix, &name_buffer[1], ds->ds[index].name);
- else
+ } else {
+ if (host->prefix == NULL)
+ sstrncpy (service_buffer, &name_buffer[1],
+ sizeof (service_buffer));
+ else
ssnprintf (service_buffer, sizeof (service_buffer),
"%s/%s", host->prefix, &name_buffer[1]);
+ }
event->service = strdup (service_buffer);