diff --git a/config/crd/bases/logging.banzaicloud.io_clusterflows.yaml b/config/crd/bases/logging.banzaicloud.io_clusterflows.yaml
index d6c77648a..a98494e63 100644
--- a/config/crd/bases/logging.banzaicloud.io_clusterflows.yaml
+++ b/config/crd/bases/logging.banzaicloud.io_clusterflows.yaml
@@ -87,7 +87,7 @@ spec:
cases are: key not exist, format is not matched, unexpected
error'
type: boolean
- hash_value_fiel:
+ hash_value_field:
description: Store parsed values as a hash value in a field.
type: string
inject_key_prefix:
@@ -109,6 +109,10 @@ spec:
keep_time_key:
description: If true, keep time field in the record.
type: boolean
+ local_time:
+ description: 'Ff true, use local time. Otherwise, UTC
+ is used. This is exclusive with utc. (default: true)'
+ type: boolean
null_empty_string:
description: If true, empty string field is replaced
with nil
@@ -116,14 +120,37 @@ spec:
null_value_pattern:
description: ' Specify null value pattern.'
type: string
+ time_format:
+ description: Process value using specified format. This
+ is available only when time_type is string
+ type: string
time_key:
description: Specify time field for event time. If the
event doesn't have this field, current time is used.
type: string
+ time_type:
+ description: 'Parse/format value according to this type
+ available values: float, unixtime, string (default:
+ string)'
+ type: string
+ timezone:
+ description: 'Use specified timezone. one can parse/format
+ the time value in the specified timezone. (default:
+ nil)'
+ type: string
type:
description: 'Parse type: apache2, apache_error, nginx,
syslog, csv, tsv, ltsv, json, multiline, none'
type: string
+ types:
+ description: 'Types casting the fields to proper types
+ example: field1:type, field2:type'
+ type: string
+ utc:
+ description: 'If true, use UTC. Otherwise, local time
+ is used. This is exclusive with localtime (default:
+ false)'
+ type: boolean
type: object
type: array
remove_key_name_field:
diff --git a/config/crd/bases/logging.banzaicloud.io_flows.yaml b/config/crd/bases/logging.banzaicloud.io_flows.yaml
index c628d2c3c..ad5a39001 100644
--- a/config/crd/bases/logging.banzaicloud.io_flows.yaml
+++ b/config/crd/bases/logging.banzaicloud.io_flows.yaml
@@ -92,7 +92,7 @@ spec:
cases are: key not exist, format is not matched, unexpected
error'
type: boolean
- hash_value_fiel:
+ hash_value_field:
description: Store parsed values as a hash value in a field.
type: string
inject_key_prefix:
@@ -114,6 +114,10 @@ spec:
keep_time_key:
description: If true, keep time field in the record.
type: boolean
+ local_time:
+ description: 'Ff true, use local time. Otherwise, UTC
+ is used. This is exclusive with utc. (default: true)'
+ type: boolean
null_empty_string:
description: If true, empty string field is replaced
with nil
@@ -121,14 +125,37 @@ spec:
null_value_pattern:
description: ' Specify null value pattern.'
type: string
+ time_format:
+ description: Process value using specified format. This
+ is available only when time_type is string
+ type: string
time_key:
description: Specify time field for event time. If the
event doesn't have this field, current time is used.
type: string
+ time_type:
+ description: 'Parse/format value according to this type
+ available values: float, unixtime, string (default:
+ string)'
+ type: string
+ timezone:
+ description: 'Use specified timezone. one can parse/format
+ the time value in the specified timezone. (default:
+ nil)'
+ type: string
type:
description: 'Parse type: apache2, apache_error, nginx,
syslog, csv, tsv, ltsv, json, multiline, none'
type: string
+ types:
+ description: 'Types casting the fields to proper types
+ example: field1:type, field2:type'
+ type: string
+ utc:
+ description: 'If true, use UTC. Otherwise, local time
+ is used. This is exclusive with localtime (default:
+ false)'
+ type: boolean
type: object
type: array
remove_key_name_field:
diff --git a/docs/plugins/filters/parser.md b/docs/plugins/filters/parser.md
index cd7d873be..1c0ff316f 100644
--- a/docs/plugins/filters/parser.md
+++ b/docs/plugins/filters/parser.md
@@ -9,7 +9,7 @@
| remove_key_name_field | bool | No | - | Remove key_name field when parsing is succeeded
|
| replace_invalid_sequence | bool | No | - | If true, invalid string is replaced with safe characters and re-parse it.
|
| inject_key_prefix | string | No | - | Store parsed values with specified key name prefix.
|
-| hash_value_fiel | string | No | - | Store parsed values as a hash value in a field.
|
+| hash_value_field | string | No | - | Store parsed values as a hash value in a field.
|
| emit_invalid_record_to_error | bool | No | - | Emit invalid record to @ERROR label. Invalid cases are: key not exist, format is not matched, unexpected error
|
| parsers | []ParseSection | No | - | [Parse Section](#Parse-Section)
|
### Parse Section
@@ -22,3 +22,9 @@
| null_empty_string | bool | No | - | If true, empty string field is replaced with nil
|
| estimate_current_event | bool | No | - | If true, use Fluent::EventTime.now(current time) as a timestamp when time_key is specified.
|
| keep_time_key | bool | No | - | If true, keep time field in the record.
|
+| types | string | No | - | Types casting the fields to proper types example: field1:type, field2:type
|
+| time_format | string | No | - | Process value using specified format. This is available only when time_type is string
|
+| time_type | string | No | string | Parse/format value according to this type available values: float, unixtime, string
|
+| local_time | bool | No | true | Ff true, use local time. Otherwise, UTC is used. This is exclusive with utc.
|
+| utc | bool | No | false | If true, use UTC. Otherwise, local time is used. This is exclusive with localtime
|
+| timezone | string | No | nil | Use specified timezone. one can parse/format the time value in the specified timezone.
|
diff --git a/pkg/model/filter/parser.go b/pkg/model/filter/parser.go
index fb11782b5..77020c9f4 100644
--- a/pkg/model/filter/parser.go
+++ b/pkg/model/filter/parser.go
@@ -36,7 +36,7 @@ type ParserConfig struct {
// Store parsed values with specified key name prefix.
InjectKeyPrefix string `json:"inject_key_prefix,omitempty"`
// Store parsed values as a hash value in a field.
- HashValueField string `json:"hash_value_fiel,omitempty"`
+ HashValueField string `json:"hash_value_field,omitempty"`
// Emit invalid record to @ERROR label. Invalid cases are: key not exist, format is not matched, unexpected error
EmitInvalidRecordToError bool `json:"emit_invalid_record_to_error,omitempty"`
// +docLink:"Parse Section,#Parse-Section"
@@ -60,6 +60,18 @@ type ParseSection struct {
EstimateCurrentEvent bool `json:"estimate_current_event,omitempty"`
// If true, keep time field in the record.
KeepTimeKey bool `json:"keep_time_key,omitempty"`
+ // Types casting the fields to proper types example: field1:type, field2:type
+ Types string `json:"types,omitempty"`
+ // Process value using specified format. This is available only when time_type is string
+ TimeFormat string `json:"time_format,omitempty"`
+ // Parse/format value according to this type available values: float, unixtime, string (default: string)
+ TimeType string `json:"time_type,omitempty"`
+ // Ff true, use local time. Otherwise, UTC is used. This is exclusive with utc. (default: true)
+ LocalTime bool `json:"local_time,omitempty"`
+ // If true, use UTC. Otherwise, local time is used. This is exclusive with localtime (default: false)
+ UTC bool `json:"utc,omitempty"`
+ // Use specified timezone. one can parse/format the time value in the specified timezone. (default: nil)
+ Timezone string `json:"timezone,omitempty"`
}
func (p *ParseSection) ToDirective(secretLoader secret.SecretLoader, id string) (types.Directive, error) {