# Logstash error: Failed to publish events

**URL:** <https://discuss.elastic.co/t/logstash-error-failed-to-publish-events/325400>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [February 13, 2023, 2:53pm UTC](https://discuss.elastic.co/t/logstash-error-failed-to-publish-events/325400 "2023-02-13T14:53:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zack\_09](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/zack_09/32/117186_2.png) [@Zack\_09](https://discuss.elastic.co/u/Zack_09)\
**Post date:** [February 13, 2023, 2:53pm UTC](https://discuss.elastic.co/t/logstash-error-failed-to-publish-events/325400/1 "2023-02-13T14:53:32Z")

</div>

Hello all ,im new in elastic when I run logstash i get the following error

```auto
   Error: Cannot assign requested address
desktop-logstash-1 | Exception: Java::JavaNet::BindException
desktop-logstash-1 | Stack: sun.nio.ch.Net.bind0(Native Method)
desktop-logstash-1 | sun.nio.ch.Net.bind(sun/nio/ch/Net.java:555)
desktop-logstash-1 | sun.nio.ch.ServerSocketChannelImpl.netBind(sun/nio/ch/ServerSocketChannelImpl.java:337)
desktop-logstash-1 | sun.nio.ch.ServerSocketChannelImpl.bind(sun/nio/ch/ServerSocketChannelImpl.java:294)
desktop-logstash-1 | io.netty.channel.socket.nio.NioServerSocketChannel.doBind(io/netty/channel/socket/nio/NioServerSocketChannel.java:134)
desktop-logstash-1 | io.netty.channel.AbstractChannel$AbstractUnsafe.bind(io/netty/channel/AbstractChannel.java:562)

```

Here all my configs :

filebeat.yml

```auto
input {
    beats{
      host => "192.168.1.107"
      port => 2021
    }
}
filter {
    grok {
        match => { "message" => "%{COMBINEDAPACHELOG}"}
    }
}
output {
    opensearch {
        hosts => ["https://node-0.example.com:9200"]
        index => "ad-logs"
        user => "admin"
        password => "admin"
        ssl => true
        ssl_certificate_verification => false
    }
}

```

docker-compose :

```auto
version: "3.7"
services:
  logstash:
    image: opensearchproject/logstash-oss-with-opensearch-output-plugin:latest
    expose:
      - 2021
    ports:
      - 2021:2021
    volumes:
      - ./logstash.conf:/usr/share/logstash/pipeline/logstash.conf
    depends_on:
      - opensearch

  opensearch:
    container_name: node-0.example.com
    image: opensearchproject/opensearch:latest
    ports:
      - "9200:9200"
      - "9600:9600"
    environment:
      - discovery.type=single-node

  opensearch-dashboard:
    container_name: opensearch-dashboard
    image: opensearchproject/opensearch-dashboards:latest
    ports:
      - 5601:5601
    expose:
      - "5601"
    environment:
      OPENSEARCH_URL: https://node-0.example.com:9200
      OPENSEARCH_HOSTS: https://node-0.example.com:9200

```

---

<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 13, 2023, 2:53pm UTC](https://discuss.elastic.co/t/logstash-error-failed-to-publish-events/325400/2 "2023-02-13T14:53:32Z")

</div>

OpenSearch/OpenDistro are AWS run products and differ from the original Elasticsearch and Kibana products that Elastic builds and maintains. You may need to contact them directly for further assistance.

(This is an automated response from your friendly Elastic bot. Please report this post if you have any suggestions or concerns :elasticheart: )

---

<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:** [February 13, 2023, 4:10pm UTC](https://discuss.elastic.co/t/logstash-error-failed-to-publish-events/325400/3 "2023-02-13T16:10:46Z")

</div>

> [@Zack\_09](#):
>
> ` Error: Cannot assign requested address`

You need to share the entire log error you got, but this means that some service could not bind to the specified port.

it is not possible to know what service because you didn't share the entire log error.

---

<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:** [February 13, 2023, 4:11pm UTC](https://discuss.elastic.co/t/logstash-error-failed-to-publish-events/325400/4 "2023-02-13T16:11:57Z")

</div>

> [@Zack\_09](#):
>
> ```auto
> input {
> beats{
> host => "192.168.1.107"
> port => 2021
> }
> }
> 
> ```

Also, if your Logstash is running on a container, the ip address `192.168.1.107` needs to be the IP of the container, if this IP is not available inside the container, them you will get an error.

---

<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 13, 2023, 4:12pm UTC](https://discuss.elastic.co/t/logstash-error-failed-to-publish-events/325400/5 "2023-03-13T16:12:44Z")

</div>

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