Logstash error: Failed to publish events

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

   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

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 :

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

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: )

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.

1 Like

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.

1 Like

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