# Transform + action

**URL:** <https://discuss.elastic.co/t/transform-action/141589>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [July 25, 2018, 1:40pm UTC](https://discuss.elastic.co/t/transform-action/141589 "2018-07-25T13:40:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrillebile](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@chrillebile](https://discuss.elastic.co/u/chrillebile)\
**Post date:** [July 25, 2018, 1:40pm UTC](https://discuss.elastic.co/t/transform-action/141589/1 "2018-07-25T13:40:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 25, 2018, 3:43pm UTC](https://discuss.elastic.co/t/transform-action/141589/2 "2018-07-25T15:43:43Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![chrillebile](https://avatars.discourse-cdn.com/v4/letter/c/dec6dc/32.png) [@chrillebile](https://discuss.elastic.co/u/chrillebile)\
**Post date:** [July 26, 2018, 9:21am UTC](https://discuss.elastic.co/t/transform-action/141589/3 "2018-07-26T09:21:33Z")

</div>

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}}"  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 26, 2018, 9:36am UTC](https://discuss.elastic.co/t/transform-action/141589/4 "2018-07-26T09:36:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 23, 2018, 9:36am UTC](https://discuss.elastic.co/t/transform-action/141589/5 "2018-08-23T09:36:29Z")

</div>

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