Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Correct fluentd prase TimeFormat config key #780

Merged
merged 3 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apis/fluentd/v1alpha1/plugins/common/buffer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func (b *Buffer) Params(_ plugins.SecretLoader) (*params.PluginStore, error) {
ps.InsertPairs("time_type", fmt.Sprint(*b.Time.TimeType))
}
if b.Time.TimeFormat != nil {
ps.InsertPairs("time_type", fmt.Sprint(*b.Time.TimeFormat))
ps.InsertPairs("time_format", fmt.Sprint(*b.Time.TimeFormat))
}
if b.Time.Localtime != nil {
ps.InsertPairs("localtime", fmt.Sprint(*b.Time.Localtime))
Expand Down
8 changes: 4 additions & 4 deletions apis/fluentd/v1alpha1/plugins/common/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ type CommonFields struct {

// Time defines the common parameters for the time plugin
type Time struct {
// parses/formats value according to this type, default is *string
// +kubebuilder:validation:Enum:=float;unixtime;*string;mixed
// parses/formats value according to this type, default is string
// +kubebuilder:validation:Enum:=float;unixtime;string;mixed
TimeType *string `json:"timeType,omitempty"`
// Process value according to the specified format. This is available only when time_type is *string
// Process value according to the specified format. This is available only when time_type is string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should change like this?

Suggested change
// Process value according to the specified format. This is available only when time_type is string
// Process value according to the specified format. This is available only when time_format is string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is correct how it is right now. The time_format only applies when time_type is set to the value string.

TimeFormat *string `json:"timeFormat,omitempty"`
// If true, uses local time.
Localtime *bool `json:"localtime,omitempty"`
Expand Down Expand Up @@ -199,7 +199,7 @@ func (j *Inject) Params(_ plugins.SecretLoader) (*params.PluginStore, error) {
ps.InsertPairs("time_type", fmt.Sprint(*j.TimeType))
}
if j.TimeFormat != nil {
ps.InsertPairs("time_type", fmt.Sprint(*j.TimeFormat))
ps.InsertPairs("time_format", fmt.Sprint(*j.TimeFormat))
}
if j.Localtime != nil {
ps.InsertPairs("localtime", fmt.Sprint(*j.Localtime))
Expand Down
2 changes: 1 addition & 1 deletion apis/fluentd/v1alpha1/plugins/common/parse_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (p *Parse) Params(_ plugins.SecretLoader) (*params.PluginStore, error) {
ps.InsertPairs("time_type", fmt.Sprint(*p.TimeType))
}
if p.TimeFormat != nil {
ps.InsertPairs("time_type", fmt.Sprint(*p.TimeFormat))
ps.InsertPairs("time_format", fmt.Sprint(*p.TimeFormat))
}
if p.Localtime != nil {
ps.InsertPairs("localtime", fmt.Sprint(*p.Localtime))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<parse>
@type regexp
expression /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) [(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)$/
time_type %d/%b/%Y:%H:%M:%S %z
time_format %d/%b/%Y:%H:%M:%S %z
</parse>
</filter>
<match **>
Expand Down Expand Up @@ -163,7 +163,7 @@
<parse>
@type regexp
expression /^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) [(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)$/
time_type %d/%b/%Y:%H:%M:%S %z
time_format %d/%b/%Y:%H:%M:%S %z
</parse>
</filter>
<match **>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ spec:
type: string
timeFormat:
description: Process value according to the specified
format. This is available only when time_type is *string
format. This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -194,11 +194,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timeout:
Expand Down Expand Up @@ -338,7 +338,7 @@ spec:
type: boolean
timeFormat:
description: Process value according to the specified
format. This is available only when time_type is *string
format. This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -348,11 +348,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timezone:
Expand Down Expand Up @@ -392,7 +392,7 @@ spec:
timeFormat:
description: Process value according to the specified
format. This is available only when time_type
is *string
is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a
Expand All @@ -402,11 +402,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timezone:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ spec:
type: string
timeFormat:
description: Process value according to the specified format.
This is available only when time_type is *string
This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -210,11 +210,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this type,
default is *string
default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timekey:
Expand Down Expand Up @@ -549,7 +549,7 @@ spec:
type: boolean
timeFormat:
description: Process value according to the specified format.
This is available only when time_type is *string
This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -559,11 +559,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this type,
default is *string
default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timezone:
Expand Down Expand Up @@ -1241,7 +1241,7 @@ spec:
type: boolean
timeFormat:
description: Process value according to the specified
format. This is available only when time_type is *string
format. This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -1251,11 +1251,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timezone:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ spec:
type: string
timeFormat:
description: Process value according to the specified
format. This is available only when time_type is *string
format. This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -194,11 +194,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timeout:
Expand Down Expand Up @@ -338,7 +338,7 @@ spec:
type: boolean
timeFormat:
description: Process value according to the specified
format. This is available only when time_type is *string
format. This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -348,11 +348,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timezone:
Expand Down Expand Up @@ -392,7 +392,7 @@ spec:
timeFormat:
description: Process value according to the specified
format. This is available only when time_type
is *string
is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a
Expand All @@ -402,11 +402,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timezone:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1747,7 +1747,7 @@ spec:
type: string
timeFormat:
description: Process value according to the specified
format. This is available only when time_type is *string
format. This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -1761,11 +1761,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timeout:
Expand Down Expand Up @@ -1996,7 +1996,7 @@ spec:
type: string
timeFormat:
description: Process value according to the specified
format. This is available only when time_type is *string
format. This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -2010,11 +2010,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timeout:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ spec:
type: string
timeFormat:
description: Process value according to the specified format.
This is available only when time_type is *string
This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -210,11 +210,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this type,
default is *string
default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timekey:
Expand Down Expand Up @@ -549,7 +549,7 @@ spec:
type: boolean
timeFormat:
description: Process value according to the specified format.
This is available only when time_type is *string
This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -559,11 +559,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this type,
default is *string
default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timezone:
Expand Down Expand Up @@ -1241,7 +1241,7 @@ spec:
type: boolean
timeFormat:
description: Process value according to the specified
format. This is available only when time_type is *string
format. This is available only when time_type is string
type: string
timeFormatFallbacks:
description: Uses the specified time format as a fallback
Expand All @@ -1251,11 +1251,11 @@ spec:
type: string
timeType:
description: parses/formats value according to this
type, default is *string
type, default is string
enum:
- float
- unixtime
- '*string'
- string
- mixed
type: string
timezone:
Expand Down
Loading