Skip to content

how to let through only the given fields #15456

Answered by tobz
tshepang asked this question in Q&A
Discussion options

You must be logged in to vote

This would depend on where you want to do the field filtering.

If you wanted the events to be cleaned up after being ingested via their source, you could use the remap transform with a program such as this:

# We can create a new object by using the `filter` function to only keep fields we know about.
# We'll pretend that `unfiltered_object` is our event object. Substitute this with `.`, etc, as
# needed to apply it to your own situation:
unfiltered_object = { "a": "true, "b": true, "aa": false }
known_fields = ["a", "b"]

filtered_object = filter(unfiltered_object) -> |key, _value| {
    # Only keep fields that are in `known_fields`.
    includes(known_fields, key)
}

# Now `filtered_obje…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jszwedko
Comment options

Answer selected by tshepang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants