# Logging formats for errors

**URL:** <https://discourse.haproxy.org/t/logging-formats-for-errors/2814>\
**Category:** Help!\
**Created:** [August 3, 2018, 12:03pm UTC](https://discourse.haproxy.org/t/logging-formats-for-errors/2814 "2018-08-03T12:03:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Markvr](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@Markvr](https://discourse.haproxy.org/u/Markvr)\
**Post date:** [August 3, 2018, 12:03pm UTC](https://discourse.haproxy.org/t/logging-formats-for-errors/2814/1 "2018-08-03T12:03:05Z")

</div>

We configure HAProxy log format for each frontend to output JSON which is then parsed by our centralised logging system.

This works fine for normal traffic, but we seem to get a lot of SSL handshake failures from clients, and when this occurs, HAProxy ignores this JSON format, and outputs plaintext, so we get a lot of JSON parse errors like:  
`JSON object is not an object; input='172.18.0.1:42770 [03/Aug/2018:11:46:05.649] port_443/1: SSL handshake failure'`

Is there a way to configure the “error” log format HAProxy uses?

Our config looks like:

```
global
  log 127.0.0.1 local0
  log 127.0.0.1 local1 notice
defaults
  log global
  mode http
  log-format "{\"timestamp\":\"%tr\",\"method\":\"%HM\",\"host\":\"%[capture.req.hdr(0)]\",\"path\":\"%HP\",\"query\":\"%HQ\",\"uob_username\":\"%[capture.res.hdr(0)]\",\"useragent\":\"%[capture.req.hdr(1)]\",\"client\":\"%ci\",\"referer\":\"%[capture.req.hdr(2)]\",\"duration\":\"%Tt\",\"size\":\"%B\",\"status\":\"%ST\",\"sslcipher\":\"%sslc\",\"sslversion\":\"%sslv\",\"sls_tag_0\":\"neptune\",\"service\":\"%b\",\"sls_tag_2\":\"%s\",\"sls_service_level\":\"${SERVICE_LEVEL}\",\"x_forwarded_for\":\"%[capture.req.hdr(3)]\"}"
frontend port_443
  log local-traffic-logger len 65535 local0
```
