diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index a35c98efc..58dbdf261 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -209,7 +209,7 @@ configuring each output sink is different, but examples can be found by running `telegraf -sample-config`. Outputs also support the same configurable options as inputs -(pass, drop, tagpass, tagdrop) +(namepass, namedrop, tagpass, tagdrop) ```toml [[outputs.influxdb]] @@ -217,14 +217,14 @@ Outputs also support the same configurable options as inputs database = "telegraf" precision = "s" # Drop all measurements that start with "aerospike" - drop = ["aerospike*"] + namedrop = ["aerospike*"] [[outputs.influxdb]] urls = [ "http://localhost:8086" ] database = "telegraf-aerospike-data" precision = "s" # Only accept aerospike data: - pass = ["aerospike*"] + namepass = ["aerospike*"] [[outputs.influxdb]] urls = [ "http://localhost:8086" ] diff --git a/etc/telegraf.conf b/etc/telegraf.conf index eaf66db96..f626eabc8 100644 --- a/etc/telegraf.conf +++ b/etc/telegraf.conf @@ -89,7 +89,7 @@ # Whether to report total system cpu stats or not totalcpu = true # Comment this line if you want the raw CPU time metrics - drop = ["time_*"] + fielddrop = ["time_*"] # Read metrics about disk usage by mount point [[inputs.disk]] diff --git a/internal/config/config.go b/internal/config/config.go index 45c085e88..09f878f50 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -477,7 +477,8 @@ func (c *Config) addInput(name string, table *ast.Table) error { return nil } -// buildFilter builds a Filter (tagpass/tagdrop/pass/drop) to +// buildFilter builds a Filter +// (tagpass/tagdrop/namepass/namedrop/fieldpass/fielddrop) to // be inserted into the internal_models.OutputConfig/internal_models.InputConfig to be used for prefix // filtering on tags and measurements func buildFilter(tbl *ast.Table) internal_models.Filter { @@ -752,5 +753,12 @@ func buildOutput(name string, tbl *ast.Table) (*internal_models.OutputConfig, er Name: name, Filter: buildFilter(tbl), } + // Outputs don't support FieldDrop/FieldPass, so set to NameDrop/NamePass + if len(oc.Filter.FieldDrop) > 0 { + oc.Filter.NameDrop = oc.Filter.FieldDrop + } + if len(oc.Filter.FieldPass) > 0 { + oc.Filter.NamePass = oc.Filter.FieldPass + } return oc, nil } diff --git a/internal/models/filter.go b/internal/models/filter.go index 48143d3ac..e2b1377f4 100644 --- a/internal/models/filter.go +++ b/internal/models/filter.go @@ -28,7 +28,7 @@ type Filter struct { } func (f Filter) ShouldMetricPass(metric telegraf.Metric) bool { - if f.ShouldFieldsPass(metric.Name()) && f.ShouldTagsPass(metric.Tags()) { + if f.ShouldNamePass(metric.Name()) && f.ShouldTagsPass(metric.Tags()) { return true } return false diff --git a/plugins/inputs/system/cpu.go b/plugins/inputs/system/cpu.go index 333339458..035b8e1f5 100644 --- a/plugins/inputs/system/cpu.go +++ b/plugins/inputs/system/cpu.go @@ -33,7 +33,7 @@ var sampleConfig = ` ## Whether to report total system cpu stats or not totalcpu = true ## Comment this line if you want the raw CPU time metrics - drop = ["time_*"] + fielddrop = ["time_*"] ` func (_ *CPUStats) SampleConfig() string {