Add unique_timestamp option from grok parser to logparser grok
This commit is contained in:
parent
4df0cc006c
commit
c023ffe0a5
|
@ -8,7 +8,6 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/influxdata/tail"
|
"github.com/influxdata/tail"
|
||||||
|
|
||||||
"github.com/influxdata/telegraf"
|
"github.com/influxdata/telegraf"
|
||||||
"github.com/influxdata/telegraf/internal/globpath"
|
"github.com/influxdata/telegraf/internal/globpath"
|
||||||
"github.com/influxdata/telegraf/plugins/inputs"
|
"github.com/influxdata/telegraf/plugins/inputs"
|
||||||
|
@ -28,6 +27,7 @@ type GrokConfig struct {
|
||||||
CustomPatterns string
|
CustomPatterns string
|
||||||
CustomPatternFiles []string
|
CustomPatternFiles []string
|
||||||
Timezone string
|
Timezone string
|
||||||
|
UniqueTimestamp string
|
||||||
}
|
}
|
||||||
|
|
||||||
type logEntry struct {
|
type logEntry struct {
|
||||||
|
@ -100,6 +100,10 @@ const sampleConfig = `
|
||||||
## 2. "Canada/Eastern" -- Unix TZ values like those found in https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
## 2. "Canada/Eastern" -- Unix TZ values like those found in https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||||
## 3. UTC -- or blank/unspecified, will return timestamp in UTC
|
## 3. UTC -- or blank/unspecified, will return timestamp in UTC
|
||||||
# timezone = "Canada/Eastern"
|
# timezone = "Canada/Eastern"
|
||||||
|
|
||||||
|
## When set to "disable", timestamp will not incremented if there is a
|
||||||
|
## duplicate.
|
||||||
|
# unique_timestamp = "auto"
|
||||||
`
|
`
|
||||||
|
|
||||||
// SampleConfig returns the sample configuration for the plugin
|
// SampleConfig returns the sample configuration for the plugin
|
||||||
|
@ -144,6 +148,7 @@ func (l *LogParserPlugin) Start(acc telegraf.Accumulator) error {
|
||||||
GrokCustomPatterns: l.GrokConfig.CustomPatterns,
|
GrokCustomPatterns: l.GrokConfig.CustomPatterns,
|
||||||
GrokCustomPatternFiles: l.GrokConfig.CustomPatternFiles,
|
GrokCustomPatternFiles: l.GrokConfig.CustomPatternFiles,
|
||||||
GrokTimezone: l.GrokConfig.Timezone,
|
GrokTimezone: l.GrokConfig.Timezone,
|
||||||
|
GrokUniqueTimestamp: l.GrokConfig.UniqueTimestamp,
|
||||||
DataFormat: "grok",
|
DataFormat: "grok",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,8 @@ you will find the https://grokdebug.herokuapp.com application quite useful!
|
||||||
## 3. UTC -- or blank/unspecified, will return timestamp in UTC
|
## 3. UTC -- or blank/unspecified, will return timestamp in UTC
|
||||||
grok_timezone = "Canada/Eastern"
|
grok_timezone = "Canada/Eastern"
|
||||||
|
|
||||||
## When grok_unique_timestamp is set to "disable", timestamp will not incremented if there is a duplicate. Default is "auto"
|
## When set to "disable" timestamp will not incremented if there is a
|
||||||
|
## duplicate.
|
||||||
# grok_unique_timestamp = "auto"
|
# grok_unique_timestamp = "auto"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue