New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: Add modify filter to change records #532

Merged
merged 2 commits into from May 17, 2018

Conversation

Projects
None yet
2 participants
@michiel
Contributor

michiel commented Mar 8, 2018

This adds a new filter, 'modify', that can rename keys and add keys with default values if they are not present.

There is some overlap with the existing 'record_modifier' functionality. For a future state, I propose a discussion around consolidating the functions into one filter.

Example,

[INPUT]
    Name mem
    Tag  mem.local

[OUTPUT]
    Name  stdout
    Match *

[FILTER]
    Name modify
    Match *
    Add_if_not_present Service1 SOMEVALUE
    Add_if_not_present Service3 SOMEVALUE3
    Add_if_not_present Mem.total2 TOTALMEM2
    Rename Mem.free MEMFREE
    Rename Mem.used MEMUSED
    Rename Swap.total SWAPTOTAL
    Add_if_not_present Mem.total TOTALMEM
}
}
static void helper_pack_string(msgpack_packer * packer, const char *str)

This comment has been minimized.

@edsiper

edsiper Apr 2, 2018

Contributor

please add a string length into this function, otherwise strlen() over and over will be expensive. Most of the cases we know before hand the string length.

This comment has been minimized.

@michiel

michiel Apr 9, 2018

Contributor

This was added in 0827ed3

michiel added some commits Mar 8, 2018

feature: Add modify filter to change records
This add a filter, called 'modify', that allows for records to be
changed in place.

Signed-off-by: Michiel Kalkman <mkalkman@shelde.com>
filter_modify: Optimize helper_pack_string function
This changes adds the length of the string to the signature of the
helper function to avoid repeated strlen() calls. Invocations have been
updated to pass it.

This change also add a copyright header to the license comments

Signed-off-by: Michiel Kalkman <mkalkman@shelde.com>

@michiel michiel force-pushed the michiel:feature/add_modify_filter branch from fcb02c7 to 0827ed3 Apr 9, 2018

@michiel

This comment has been minimized.

Contributor

michiel commented Apr 9, 2018

Documentation PR added at fluent/fluent-bit-docs#63

@edsiper edsiper merged commit af8b080 into fluent:master May 17, 2018

2 checks passed

DCO All commits have a DCO sign-off from the author
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@edsiper

This comment has been minimized.

Contributor

edsiper commented May 17, 2018

thanks

edsiper added a commit that referenced this pull request May 21, 2018

filter_modify: new filter to change records (#532)
* feature: Add modify filter to change records

This add a filter, called 'modify', that allows for records to be
changed in place.

Signed-off-by: Michiel Kalkman <mkalkman@shelde.com>

* filter_modify: Optimize helper_pack_string function

This changes adds the length of the string to the signature of the
helper function to avoid repeated strlen() calls. Invocations have been
updated to pass it.

This change also add a copyright header to the license comments

Signed-off-by: Michiel Kalkman <mkalkman@shelde.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment