# Extract SNI value for logging in TCP mode

**URL:** <https://discourse.haproxy.org/t/extract-sni-value-for-logging-in-tcp-mode/6690>\
**Category:** Help!\
**Created:** [July 1, 2021, 7:04am UTC](https://discourse.haproxy.org/t/extract-sni-value-for-logging-in-tcp-mode/6690 "2021-07-01T07:04:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![shadyabhi](https://avatars.discourse-cdn.com/v4/letter/s/edb3f5/32.png) [@shadyabhi](https://discourse.haproxy.org/u/shadyabhi)\
**Post date:** [July 1, 2021, 10:18pm UTC](https://discourse.haproxy.org/t/extract-sni-value-for-logging-in-tcp-mode/6690/2 "2021-07-01T22:18:32Z")

</div>

Apparently, the answer to this already existed in another thread. [Log SNI in TCP mode](https://discourse.haproxy.org/t/log-sni-in-tcp-mode/1534)

The ordering matters, capture has to come before accept. This works for me.

```auto
    tcp-request inspect-delay 3s
    tcp-request content capture req.ssl_sni len 100

```

`log-format "%[capture.req.hdr(0)]"`

---

_[View the full topic](https://discourse.haproxy.org/t/extract-sni-value-for-logging-in-tcp-mode/6690)._
