Skip to content

Commit c0a8d3a

Browse files
committed
Fix toml option names in parser processor (#5218)
(cherry picked from commit 4e35732)
1 parent 36cbb9d commit c0a8d3a

File tree

1 file changed

+26
-27
lines changed

1 file changed

+26
-27
lines changed

plugins/parsers/registry.go

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"time"
66

77
"github.com/influxdata/telegraf"
8-
98
"github.com/influxdata/telegraf/plugins/parsers/collectd"
109
"github.com/influxdata/telegraf/plugins/parsers/csv"
1110
"github.com/influxdata/telegraf/plugins/parsers/dropwizard"
@@ -61,69 +60,69 @@ type Parser interface {
6160
// and can be used to instantiate _any_ of the parsers.
6261
type Config struct {
6362
// Dataformat can be one of: json, influx, graphite, value, nagios
64-
DataFormat string
63+
DataFormat string `toml:"data_format"`
6564

6665
// Separator only applied to Graphite data.
67-
Separator string
66+
Separator string `toml:"separator"`
6867
// Templates only apply to Graphite data.
69-
Templates []string
68+
Templates []string `toml:"templates"`
7069

7170
// TagKeys only apply to JSON data
72-
TagKeys []string
71+
TagKeys []string `toml:"tag_keys"`
7372
// FieldKeys only apply to JSON
74-
JSONStringFields []string
73+
JSONStringFields []string `toml:"json_string_fields"`
7574

76-
JSONNameKey string
75+
JSONNameKey string `toml:"json_name_key"`
7776
// MetricName applies to JSON & value. This will be the name of the measurement.
78-
MetricName string
77+
MetricName string `toml:"metric_name"`
7978

8079
// holds a gjson path for json parser
81-
JSONQuery string
80+
JSONQuery string `toml:"json_query"`
8281

8382
// key of time
84-
JSONTimeKey string
83+
JSONTimeKey string `toml:"json_time_key"`
8584

8685
// time format
87-
JSONTimeFormat string
86+
JSONTimeFormat string `toml:"json_time_format"`
8887

8988
// Authentication file for collectd
90-
CollectdAuthFile string
89+
CollectdAuthFile string `toml:"collectd_auth_file"`
9190
// One of none (default), sign, or encrypt
92-
CollectdSecurityLevel string
91+
CollectdSecurityLevel string `toml:"collectd_security_level"`
9392
// Dataset specification for collectd
94-
CollectdTypesDB []string
93+
CollectdTypesDB []string `toml:"collectd_types_db"`
9594

9695
// whether to split or join multivalue metrics
97-
CollectdSplit string
96+
CollectdSplit string `toml:"collectd_split"`
9897

9998
// DataType only applies to value, this will be the type to parse value to
100-
DataType string
99+
DataType string `toml:"data_type"`
101100

102101
// DefaultTags are the default tags that will be added to all parsed metrics.
103-
DefaultTags map[string]string
102+
DefaultTags map[string]string `toml:"default_tags"`
104103

105104
// an optional json path containing the metric registry object
106105
// if left empty, the whole json object is parsed as a metric registry
107-
DropwizardMetricRegistryPath string
106+
DropwizardMetricRegistryPath string `toml:"dropwizard_metric_registry_path"`
108107
// an optional json path containing the default time of the metrics
109108
// if left empty, the processing time is used
110-
DropwizardTimePath string
109+
DropwizardTimePath string `toml:"dropwizard_time_path"`
111110
// time format to use for parsing the time field
112111
// defaults to time.RFC3339
113-
DropwizardTimeFormat string
112+
DropwizardTimeFormat string `toml:"dropwizard_time_format"`
114113
// an optional json path pointing to a json object with tag key/value pairs
115114
// takes precedence over DropwizardTagPathsMap
116-
DropwizardTagsPath string
115+
DropwizardTagsPath string `toml:"dropwizard_tags_path"`
117116
// an optional map containing tag names as keys and json paths to retrieve the tag values from as values
118117
// used if TagsPath is empty or doesn't return any tags
119-
DropwizardTagPathsMap map[string]string
118+
DropwizardTagPathsMap map[string]string `toml:"dropwizard_tag_paths_map"`
120119

121120
//grok patterns
122-
GrokPatterns []string
123-
GrokNamedPatterns []string
124-
GrokCustomPatterns string
125-
GrokCustomPatternFiles []string
126-
GrokTimezone string
121+
GrokPatterns []string `toml:"grok_patterns"`
122+
GrokNamedPatterns []string `toml:"grok_named_patterns"`
123+
GrokCustomPatterns string `toml:"grok_custom_patterns"`
124+
GrokCustomPatternFiles []string `toml:"grok_custom_pattern_files"`
125+
GrokTimezone string `toml:"grok_timezone"`
127126

128127
//csv configuration
129128
CSVColumnNames []string `toml:"csv_column_names"`

0 commit comments

Comments
 (0)