Skip to content

Commit

Permalink
add missing options to parser
Browse files Browse the repository at this point in the history
  • Loading branch information
tarokkk committed Oct 26, 2019
1 parent 58157ed commit 3592cb9
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 4 deletions.
29 changes: 28 additions & 1 deletion config/crd/bases/logging.banzaicloud.io_clusterflows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -109,21 +109,48 @@ 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
type: boolean
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:
Expand Down
29 changes: 28 additions & 1 deletion config/crd/bases/logging.banzaicloud.io_flows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -114,21 +114,48 @@ 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
type: boolean
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:
Expand Down
8 changes: 7 additions & 1 deletion docs/plugins/filters/parser.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
| remove_key_name_field | bool | No | - | Remove key_name field when parsing is succeeded<br> |
| replace_invalid_sequence | bool | No | - | If true, invalid string is replaced with safe characters and re-parse it.<br> |
| inject_key_prefix | string | No | - | Store parsed values with specified key name prefix.<br> |
| hash_value_fiel | string | No | - | Store parsed values as a hash value in a field.<br> |
| hash_value_field | string | No | - | Store parsed values as a hash value in a field.<br> |
| 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<br> |
| parsers | []ParseSection | No | - | [Parse Section](#Parse-Section)<br> |
### Parse Section
Expand All @@ -22,3 +22,9 @@
| null_empty_string | bool | No | - | If true, empty string field is replaced with nil<br> |
| estimate_current_event | bool | No | - | If true, use Fluent::EventTime.now(current time) as a timestamp when time_key is specified.<br> |
| keep_time_key | bool | No | - | If true, keep time field in the record.<br> |
| types | string | No | - | Types casting the fields to proper types example: field1:type, field2:type<br> |
| time_format | string | No | - | Process value using specified format. This is available only when time_type is string<br> |
| time_type | string | No | string | Parse/format value according to this type available values: float, unixtime, string <br> |
| local_time | bool | No | true | Ff true, use local time. Otherwise, UTC is used. This is exclusive with utc. <br> |
| utc | bool | No | false | If true, use UTC. Otherwise, local time is used. This is exclusive with localtime <br> |
| timezone | string | No | nil | Use specified timezone. one can parse/format the time value in the specified timezone. <br> |
14 changes: 13 additions & 1 deletion pkg/model/filter/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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) {
Expand Down

0 comments on commit 3592cb9

Please sign in to comment.