Skip to content

Can I delete the body of a log using the transformprocessor or any other processors? #40293

Closed Answered by edmocosta
azagarelz asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @azagarelz, the set function currently does not allow setting nil values, that's why your statement is not changing the log data.

value is any value type. If value resolves to nil, e.g. it references an unset map value, there will be no action.

As an alternative, you can set it to empty string (or any other supported type):

 - context: log
   statements:
    - set(body, "")

Resulting in something like:

"body": {
 "stringValue": ""
}

Instead of empty when nil:

"body": {}

You can test that out here, if that does not work for you, I suggest you to open an issue to further discuss it. Thanks!

Replies: 1 comment 1 reply

Comment options

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

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