Skip to content

Commit

Permalink
adding the tags in the graylog output plugin
Browse files Browse the repository at this point in the history
closes #1861
  • Loading branch information
Edie Zhang authored and jackzampolin committed Oct 7, 2016
1 parent 0b1ee6c commit 29c3a90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ continue sending logs to /var/log/telegraf/telegraf.log.

### Features

- [#1861](https:/influxdata/telegraf/pull/1861): adding the tags in the graylog output plugin
- [#1732](https:/influxdata/telegraf/pull/1732): Telegraf systemd service, log to journal.
- [#1782](https:/influxdata/telegraf/pull/1782): Allow numeric and non-string values for tag_keys.
- [#1694](https:/influxdata/telegraf/pull/1694): Adding Gauge and Counter metric types.
Expand Down
9 changes: 7 additions & 2 deletions plugins/outputs/graylog/graylog.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 29c3a90

Please sign in to comment.