adding the tags in the graylog output plugin

closes #1861
This commit is contained in:
Edie Zhang
2016-10-07 11:47:23 +11:00
committed by Cameron Sparr
parent 7f0fe78615
commit 4f06f6b3d8
2 changed files with 8 additions and 2 deletions

View File

@@ -226,9 +226,14 @@ func serialize(metric telegraf.Metric) ([]string, error) {
m["host"] = host
}
for key, value := range metric.Tags() {
if key != "host" {
m["_"+key] = value
}
}
for key, value := range metric.Fields() {
nkey := fmt.Sprintf("_%s", key)
m[nkey] = value
m["_"+key] = value
}
serialized, err := ejson.Marshal(m)