Skip to content

Commit

Permalink
feat/groundwork-output: allow message to be a field, not just a tag
Browse files Browse the repository at this point in the history
Extend the groundwork output plugin to recognize the "message" data
when it comes in as a field rather than only when it comes in as a tag.
This is necessary to process syslog data, inasmuch as the syslog input
plugin generates a "message" field containing the syslog message.
  • Loading branch information
gh authored and Pavlo Sumkin committed Jun 27, 2022
1 parent d06559a commit cbc75a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion plugins/outputs/groundwork/groundwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,13 @@ func (g *Groundwork) parseMetric(metric telegraf.Metric) (metricMeta, *transit.M
status = value
}

message, _ := metric.GetTag("message")
message := ""
if m, ok := metric.GetTag("message"); ok {
message = m
}
if m, ok := metric.GetField("message"); ok {
message = m.(string)
}

unitType := string(transit.UnitCounter)
if value, present := metric.GetTag("unitType"); present {
Expand Down

0 comments on commit cbc75a2

Please sign in to comment.