# Failed to publish events, Logstash and Agent

**URL:** <https://discuss.elastic.co/t/failed-to-publish-events-logstash-and-agent/376388>\
**Category:** Logstash\
**Tags:** elastic-stack-monitoring, docker\
**Created:** [March 25, 2025, 3:42pm UTC](https://discuss.elastic.co/t/failed-to-publish-events-logstash-and-agent/376388 "2025-03-25T15:42:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Viktor\_Movita](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/viktor_movita/32/135707_2.png) [@Viktor\_Movita](https://discuss.elastic.co/u/Viktor_Movita)\
**Post date:** [March 25, 2025, 3:42pm UTC](https://discuss.elastic.co/t/failed-to-publish-events-logstash-and-agent/376388/1 "2025-03-25T15:42:12Z")

</div>

Hello,  
I am trying to deploy a Logstash service on OCP using an Elastic-provided image: elastic/logstash:8.16.3  
The service needs to receive input data from elastic-agents and forward it accordingly.  
My input pipeline:

```auto
input {
  elastic-agent {
    port => 5044
    host "0.0.0.0"
    ssl_enabled => true
    ssl_certificate_authorities => "path"
    ssl_certificate => "path"
    ssl_key => "path"
    ssl_client_authentication => "required"
  }
}

```

On the agent side, I consistently receive the following errors:

> Connection to backoff(async(tcp://\*\*\*\*:5044)) established  
> 6 events out of 6 events sent to logstash host \*\*\*\*:5044. Continue sending  
> close connection  
> Failed to publish events: client is not connected

What do you recommend doing?

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [March 25, 2025, 4:33pm UTC](https://discuss.elastic.co/t/failed-to-publish-events-logstash-and-agent/376388/2 "2025-03-25T16:33:59Z")

</div>

What is OCP?

Is this running on docker? Kubernetes? Can you share the docker-compose or any other config?

Do you have any error on Logstash logs?

---

<div class="post-metadata">

**Author:** ![Viktor\_Movita](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/viktor_movita/32/135707_2.png) [@Viktor\_Movita](https://discuss.elastic.co/u/Viktor_Movita)\
**Post date:** [March 26, 2025, 6:08am UTC](https://discuss.elastic.co/t/failed-to-publish-events-logstash-and-agent/376388/3 "2025-03-26T06:08:32Z")

</div>

OCP is OpenShift Container Platform  
This is actually Kubernetes.

The current setup is that I connect from the outside on port 443, which is then forwarded internally to port 5044.  
The communication appears to be working since I can successfully query the API from the outside and retrieve information about the service.

Can you guide me on which configuration settings I should verify that might be causing the issue I'm experiencing?

---

<div class="post-metadata">

**Author:** ![Viktor\_Movita](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/viktor_movita/32/135707_2.png) [@Viktor\_Movita](https://discuss.elastic.co/u/Viktor_Movita)\
**Post date:** [March 26, 2025, 9:04am UTC](https://discuss.elastic.co/t/failed-to-publish-events-logstash-and-agent/376388/4 "2025-03-26T09:04:59Z")

</div>

The issue has been resolved. At the Kubernetes level, it is mandatory to use a nodeport.
