Skip to content

Commit

Permalink
rename option to max_characters
Browse files Browse the repository at this point in the history
  • Loading branch information
kvch committed Apr 1, 2019
1 parent cad13a3 commit 4179120
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libbeat/processors/actions/truncate_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import (
type truncateFieldsConfig struct {
Fields []string `config:"fields"`
MaxBytes int `config:"max_bytes" validate:"min=0"`
MaxCount int `config:"max_character_count" validate:"min=0"`
MaxChars int `config:"max_characters" validate:"min=0"`
IgnoreMissing bool `config:"ignore_missing"`
FailOnError bool `config:"fail_on_error"`
}
Expand All @@ -50,7 +50,7 @@ func init() {
processors.RegisterPlugin("truncate_fields",
configChecked(newTruncateFields,
requireFields("fields"),
mutuallyExclusiveRequiredFields("max_bytes", "max_count"),
mutuallyExclusiveRequiredFields("max_bytes", "max_characters"),
),
)
}
Expand Down Expand Up @@ -153,8 +153,8 @@ func (f *truncateFields) truncateBytes(value []byte) ([]byte, error) {

func (f *truncateFields) truncateCharacters(value []byte) ([]byte, error) {
count := utf8.RuneCount(value)
if count > f.config.MaxCount {
count = f.config.MaxCount
if count > f.config.MaxChars {
count = f.config.MaxChars
}

r := bytes.NewReader(value)
Expand Down

0 comments on commit 4179120

Please sign in to comment.