# SSL Subject Missing on TCP Input Plugin

**URL:** https://discuss.elastic.co/t/ssl-subject-missing-on-tcp-input-plugin/297632
**Category:** Logstash
**Created:** [February 18, 2022, 6:04pm UTC](https://discuss.elastic.co/t/ssl-subject-missing-on-tcp-input-plugin/297632 "2022-02-18T18:04:18Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![gharryg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/gharryg/32/101999_2.png) [@gharryg](https://discuss.elastic.co/u/gharryg)
#### Post date: [February 18, 2022, 6:04pm UTC](https://discuss.elastic.co/t/ssl-subject-missing-on-tcp-input-plugin/297632/1 "2022-02-18T18:04:18Z")

</div>

I am working with Logstash (8.0.0) and using the TCP input plugin with SSL enabled. According the [documentation](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-tcp.html#plugins-inputs-tcp-ecs_metadata), there should be a field that contains the subject of the certificate for the connecting client. However, it seems like the field is missing from @metadata.

Here is the pipeline that I'm using:

```auto
input {
    tcp {
        port => 6514
        ssl_enable => true
        ssl_cert => "/usr/share/logstash/tls/syslog.cert.pem"
        ssl_key => "/usr/share/logstash/tls/syslog.key.pem"
        ssl_certificate_authorities => ["/usr/share/logstash/tls/ca.cert.pem"]
    }
}
filter {
    grok {
        match => { "message" => ".+-: (?<raw_json>{.+}$)"}
    }
    json {
        source => "raw_json"
    }
}
output {
    stdout { codec => rubydebug { metadata => true } }
    elasticsearch {
        cloud_id => <redacted>
        user => <redacted>
        password => <redacted>
    }
}

```

All I see in @metadata is the following:

```auto
"@metadata" => {
    "input" => {
        "tcp" => {
            "source" => {
                "name" => <redacted>,
                    "ip" => <redacted>,
                "port" => 54097
            }
        }
    }
}

```

There is a GitHub issue that has been open for almost three years with two PRs that describes the same issue I'm having: [https://github.com/logstash-plugins/logstash-input-tcp/issues/143](https://github.com/logstash-plugins/logstash-input-tcp/issues/143)

Is anyone else experiencing this issue? Does anyone have a workaround? Thanks!

---

<div class="post-metadata">

### Author: ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)
#### Post date: [February 18, 2022, 10:31pm UTC](https://discuss.elastic.co/t/ssl-subject-missing-on-tcp-input-plugin/297632/2 "2022-02-18T22:31:18Z")

</div>

The [decoration](https://github.com/logstash-plugins/logstash-input-tcp/blob/038acbe088f205cf25f1a0c577292f8c3ffe46dc/lib/logstash/inputs/tcp.rb#L266) is conditional on socket not being nil. The DecoderImpl always [sets socket to nil](https://github.com/logstash-plugins/logstash-input-tcp/blob/038acbe088f205cf25f1a0c577292f8c3ffe46dc/lib/logstash/inputs/tcp/decoder_impl.rb#L23), so it appears to me that anyone using a tcp input in server mode will have this problem.

Back in 5.0 it looks like the input loop had access to the socket directly, I cannot find when this changed.

---

<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: [March 18, 2022, 10:32pm UTC](https://discuss.elastic.co/t/ssl-subject-missing-on-tcp-input-plugin/297632/3 "2022-03-18T22:32:09Z")

</div>

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