diff --git a/plugins/serializers/splunkmetric/splunkmetric.go b/plugins/serializers/splunkmetric/splunkmetric.go index 801d0d69ea8a9..b96db5cf81155 100644 --- a/plugins/serializers/splunkmetric/splunkmetric.go +++ b/plugins/serializers/splunkmetric/splunkmetric.go @@ -23,7 +23,6 @@ type CommonTags struct { type HECTimeSeries struct { Time float64 `json:"time"` - Event string `json:"event"` Host string `json:"host,omitempty"` Index string `json:"index,omitempty"` Source string `json:"source,omitempty"` @@ -76,7 +75,6 @@ func (s *serializer) createMulti(metric telegraf.Metric, dataGroup HECTimeSeries var metricJSON []byte // Set the event data from the commonTags above. - dataGroup.Event = "metric" dataGroup.Time = commonTags.Time dataGroup.Host = commonTags.Host dataGroup.Index = commonTags.Index @@ -131,8 +129,6 @@ func (s *serializer) createSingle(metric telegraf.Metric, dataGroup HECTimeSerie continue } - dataGroup.Event = "metric" - dataGroup.Time = commonTags.Time // Apply the common tags from above to every record. diff --git a/plugins/serializers/splunkmetric/splunkmetric_test.go b/plugins/serializers/splunkmetric/splunkmetric_test.go index 5ce5265d86f3b..c00bcc7798aac 100644 --- a/plugins/serializers/splunkmetric/splunkmetric_test.go +++ b/plugins/serializers/splunkmetric/splunkmetric_test.go @@ -52,7 +52,7 @@ func TestSerializeMetricFloatHec(t *testing.T) { var buf []byte buf, err = s.Serialize(m) assert.NoError(t, err) - expS := `{"time":1529875740.819,"event":"metric","fields":{"_value":91.5,"cpu":"cpu0","metric_name":"cpu.usage_idle"}}` + expS := `{"time":1529875740.819,"fields":{"_value":91.5,"cpu":"cpu0","metric_name":"cpu.usage_idle"}}` assert.Equal(t, string(expS), string(buf)) } @@ -92,7 +92,7 @@ func TestSerializeMetricIntHec(t *testing.T) { buf, err = s.Serialize(m) assert.NoError(t, err) - expS := `{"time":0,"event":"metric","fields":{"_value":90,"cpu":"cpu0","metric_name":"cpu.usage_idle"}}` + expS := `{"time":0,"fields":{"_value":90,"cpu":"cpu0","metric_name":"cpu.usage_idle"}}` assert.Equal(t, string(expS), string(buf)) } @@ -132,7 +132,7 @@ func TestSerializeMetricBoolHec(t *testing.T) { buf, err = s.Serialize(m) assert.NoError(t, err) - expS := `{"time":0,"event":"metric","fields":{"_value":0,"container-name":"telegraf-test","metric_name":"docker.oomkiller"}}` + expS := `{"time":0,"fields":{"_value":0,"container-name":"telegraf-test","metric_name":"docker.oomkiller"}}` assert.Equal(t, string(expS), string(buf)) } @@ -238,7 +238,7 @@ func TestSerializeBatchHec(t *testing.T) { buf, err := s.SerializeBatch(metrics) assert.NoError(t, err) - expS := `{"time":0,"event":"metric","fields":{"_value":42,"metric_name":"cpu.value"}}{"time":0,"event":"metric","fields":{"_value":92,"metric_name":"cpu.value"}}` + expS := `{"time":0,"fields":{"_value":42,"metric_name":"cpu.value"}}{"time":0,"fields":{"_value":92,"metric_name":"cpu.value"}}` assert.Equal(t, string(expS), string(buf)) } @@ -260,6 +260,6 @@ func TestSerializeMultiHec(t *testing.T) { buf, err := s.SerializeBatch(metrics) assert.NoError(t, err) - expS := `{"time":0,"event":"metric","fields":{"metric_name:cpu.system":8,"metric_name:cpu.usage":42}}` + expS := `{"time":0,"fields":{"metric_name:cpu.system":8,"metric_name:cpu.usage":42}}` assert.Equal(t, string(expS), string(buf)) }