# How to detect and log 400 bad requests?

**URL:** <https://discuss.elastic.co/t/how-to-detect-and-log-400-bad-requests/163778>\
**Category:** Elasticsearch\
**Created:** [January 10, 2019, 3:53pm UTC](https://discuss.elastic.co/t/how-to-detect-and-log-400-bad-requests/163778 "2019-01-10T15:53:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gcsabbagh](https://avatars.discourse-cdn.com/v4/letter/g/b4bc9f/32.png) [@gcsabbagh](https://discuss.elastic.co/u/gcsabbagh)\
**Post date:** [January 10, 2019, 3:53pm UTC](https://discuss.elastic.co/t/how-to-detect-and-log-400-bad-requests/163778/1 "2019-01-10T15:53:59Z")

</div>

Hello,

My apologies if asked before but I've been scouting the forums and the docs for hours trying to figure this out..

My setup:

Fluentd daemonset on Kubernetes collecting logs from containers and sending them to AWS Elasticsearch service by bulk API

Problem:

Sometimes apps write malformed logs, resulting in 400 bad requests (mapping conflicts). I have logs for fluentd but it only contains the response, so I can only see the error and the index name.

Is it possible to log request body+error on 400 errors in Elasticsearch? Payload will help me immensely figure out what apps are misbehaving

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [January 13, 2019, 12:21pm UTC](https://discuss.elastic.co/t/how-to-detect-and-log-400-bad-requests/163778/2 "2019-01-13T12:21:20Z")

</div>

As far as I know it is not possible. To support this type of analysis, Logstash introduced a [dead-letter queue](https://www.elastic.co/guide/en/logstash/6.5/dead-letter-queues.html) to which incorrect entries can be written and later analysed. Here it is however the client that matches event with response and takes action.

---

<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 10, 2019, 12:21pm UTC](https://discuss.elastic.co/t/how-to-detect-and-log-400-bad-requests/163778/3 "2019-02-10T12:21:28Z")

</div>

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