Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Should the right padding modifer also trim whitespace ? #7

Open
jakelandis opened this issue Sep 7, 2018 · 3 comments
Open

Should the right padding modifer also trim whitespace ? #7

jakelandis opened this issue Sep 7, 2018 · 3 comments
Labels

Comments

@jakelandis
Copy link
Collaborator

Perhaps this is an implementation detail of the ingest node processor.. but there is a deceptive use case w/r/t to the right padding modifier.

This is documented and works as expected:

pattern: %{a->} %{b}
string: foo         bar
result: a='foo', b='bar'

However, this unexpected:

pattern: %{a->}: %{b}
string: foo        : bar
result: a='foo        ', b='bar'

Notice how a carries forward the empty spaces. It actually has nothing to do with the right padding modifier -> , and the same result is achieved without it:

pattern: %{a}: %{b}
string: foo        : bar
result: a='foo        ', b='bar'

For %{a->}: example, it is surprising that the -> does not skip the whitespace.

I propose that the dissect spec should require implementations to right trim any whitespace (space, new line, and tabs) for keys that define the -> modifier.

thoughts?

cc: @felixbarny @ph @guyboertje

@guyboertje
Copy link

In my opinion, we should offer a trim_whitespace setting that trims all field values plucked from the source.
You describe an extreme case of:

pattern: %{a}-%{b}
string: foo - bar
result: a='foo ', b=' bar'

@ph
Copy link

ph commented Oct 29, 2018

@guyboertje trim_whitespace would trim left/right side of values?

" ok " => "ok"

@guyboertje
Copy link

Both sides I think.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants