Transform + action

Hey,

Is it possible to use the values you get from transform in the action log message?
In my transform, I calculate the derivative and want to display it in my log/slack message.

1 Like

If you are using a transform, then you can only use the values, that the transform returns, and you do not have access to the original payload.

Can you explain where the problem is or show the transform snippet?

Thanks!

Hey, I'm trying to access the transform's payload from actions in order to see it in logs.

Here's an example:

"transform": {
"script": {
"source": "ctx.payload.transform = []; def document = []; for (int j=0;j<ctx.payload.hits.hits;j++){ document = ['test': ctx.payload.hits.hits[j]._source.message]; ctx.payload.transform.add(document); } return ctx.payload.transform;",
"lang": "painless"
}
},
"actions": {
"my-logging-action": {
"logging": {
"level": "info",
"text": "{{ctx.payload.transform}}"
}
}
}

1 Like

the payload is replaced with the data you return in the transform. try logging {{ctx.payload}} and you will see your list.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.