Skip to content

Commit ccdc37e

Browse files
cosmastechcw-Guo
authored andcommitted
Update logfmt_types.go
Signed-off-by: Luke Kuzmish <[email protected]>
1 parent cb5ea70 commit ccdc37e

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

apis/fluentbit/v1alpha2/plugins/parser/logfmt_types.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,29 @@ import (
99

1010
// The logfmt parser allows to parse the logfmt format described in https://brandur.org/logfmt . <br />
1111
// **For full documentation, refer to https://docs.fluentbit.io/manual/pipeline/parsers/logfmt**
12-
type Logfmt struct{}
12+
type Logfmt struct{
13+
// Time_Key
14+
TimeKey string `json:"timeKey,omitempty"`
15+
// Time_Format, eg. %Y-%m-%dT%H:%M:%S %z
16+
TimeFormat string `json:"timeFormat,omitempty"`
17+
// Time_Keep
18+
TimeKeep *bool `json:"timeKeep,omitempty"`
19+
}
1320

1421
func (_ *Logfmt) Name() string {
1522
return "logfmt"
1623
}
1724

18-
func (_ *Logfmt) Params(_ plugins.SecretLoader) (*params.KVs, error) {
19-
return nil, nil
25+
func (j *Logfmt) Params(_ plugins.SecretLoader) (*params.KVs, error) {
26+
kvs := params.NewKVs()
27+
if l.TimeKey != "" {
28+
kvs.Insert("Time_Key", l.TimeKey)
29+
}
30+
if l.TimeFormat != "" {
31+
kvs.Insert("Time_Format", l.TimeFormat)
32+
}
33+
if l.TimeKeep != nil {
34+
kvs.Insert("Time_Keep", fmt.Sprint(*l.TimeKeep))
35+
}
36+
return kvs, nil
2037
}

0 commit comments

Comments
 (0)