# ES Plugin to log rest requests

**URL:** <https://discuss.elastic.co/t/es-plugin-to-log-rest-requests/162836>\
**Category:** Elasticsearch\
**Created:** [January 3, 2019, 3:51pm UTC](https://discuss.elastic.co/t/es-plugin-to-log-rest-requests/162836 "2019-01-03T15:51:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![saikettewary](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@saikettewary](https://discuss.elastic.co/u/saikettewary)\
**Post date:** [January 3, 2019, 3:51pm UTC](https://discuss.elastic.co/t/es-plugin-to-log-rest-requests/162836/1 "2019-01-03T15:51:46Z")

</div>

Hi,  
I have a plugin that logs all rest requests . Currently this is implemented using getRestHandlerWrapper with my plugins RestHandler.

What is other way i can achieve the same without using getRestHandlerWrapper as i understand only one plugin in the cluster can implement this.

Thanks  
Saiket

---

<div class="post-metadata">

**Author:** ![saikettewary](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@saikettewary](https://discuss.elastic.co/u/saikettewary)\
**Post date:** [January 4, 2019, 4:26pm UTC](https://discuss.elastic.co/t/es-plugin-to-log-rest-requests/162836/2 "2019-01-04T16:26:19Z")

</div>

Hi @s1monw sorry for tagging you directly here .. but i was hoping if you have a quick note on this.

---

<div class="post-metadata">

**Author:** ![s1monw](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/s1monw/32/3637_2.png) [@s1monw](https://discuss.elastic.co/u/s1monw)\
**Post date:** [January 5, 2019, 9:26am UTC](https://discuss.elastic.co/t/es-plugin-to-log-rest-requests/162836/3 "2019-01-05T09:26:30Z")

</div>

> [@saikettewary](#):
>
> What is other way i can achieve the same without using getRestHandlerWrapper as i understand only one plugin in the cluster can implement this.

only one plugin per node can implement this, not per cluster. There is no other way to implement this right now.

---

<div class="post-metadata">

**Author:** ![saikettewary](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@saikettewary](https://discuss.elastic.co/u/saikettewary)\
**Post date:** [January 7, 2019, 4:01pm UTC](https://discuss.elastic.co/t/es-plugin-to-log-rest-requests/162836/4 "2019-01-07T16:01:38Z")

</div>

Thanks for the response @s1monw , I truly appreciate it. Do you know if this will/might change in future releases?

Also i came across this test Case in elastic codebase -

> <https://github.com/elastic/elasticsearch/blob/543e8b8b57b321f0c89f3cdfac14de0d57c1fdcd/modules/reindex/src/test/java/org/elasticsearch/index/reindex/ReindexFromRemoteWithAuthTests.java#L131>

Where the comment says "Action filter that will reject the request if it isn't authenticated." and when i look at void apply method inside TestFilter , its doing  
chain.proceed(task, action, request, listener);

How is this different? Isn't it also pre-processing the rest requests for authentication?

---

<div class="post-metadata">

**Author:** ![rjernst](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rjernst/32/6363_2.png) [@rjernst](https://discuss.elastic.co/u/rjernst)\
**Post date:** [January 9, 2019, 1:11am UTC](https://discuss.elastic.co/t/es-plugin-to-log-rest-requests/162836/5 "2019-01-09T01:11:56Z")

</div>

The chain you see there is for transport actions. This is an older way of extending, which rest actions used to also do. However, the chaining was complicated and error prone. Transport actions will eventually be moved to a singular wrapper as well. It is unlikely this will be relaxed in the future, as the complexity of supporting multiple was too cumbersome to maintain.

---

<div class="post-metadata">

**Author:** ![saikettewary](https://avatars.discourse-cdn.com/v4/letter/s/7ea924/32.png) [@saikettewary](https://discuss.elastic.co/u/saikettewary)\
**Post date:** [January 9, 2019, 3:36pm UTC](https://discuss.elastic.co/t/es-plugin-to-log-rest-requests/162836/6 "2019-01-09T15:36:39Z")

</div>

> [@rjernst](#):
>
> transport actions

Thanks for the information. It is helpful.

---

<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:** [February 6, 2019, 3:36pm UTC](https://discuss.elastic.co/t/es-plugin-to-log-rest-requests/162836/7 "2019-02-06T15:36:40Z")

</div>

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