Hello ,
I am running a Logstash as Docker container using the following command:
..........
docker run --rm -d --name logstash-Casex -p 8080:8080 -p 8081:8081 -v /Logstash_custom_configs/config/pipelines.yml:/usr/share/logstash/config/pipelines.yml -v /Logstash_custom_configs/mycurated:/usr/share/logstash/zlda-pipeline-curated -v /Logstash_custom_configs/myraw:/usr/share/logstash/zlda-pipeline-raw -v /tmp:/tmp docker.elastic.co/logstash/logstash:7.12.0
......
and I expect following input plugin is read (it's stored as B_cdpz.conf under Logstash_custom_configs/mycurated):
# IZCDP Elastic Stack Ingestion
#
# TCPIP Input Stage
#
# Generated by IBM for IBM Z Common Data Provider
# Copyright IBM Corporation (C) 2017, 2019
#
# Licensed for usage ingesting data streams from IBM Z Common Data
# Provider through Logstash
#
input {
tcp {
host => "9.30.118.124"
port => 8081
}
}
-----
But I cannot bind the ip address 9.30.118.124 and port 8081.
Here is the main extract from the logstash log:
..........
[2022-06-08T09:18:46,775][WARN ][deprecation.logstash.filters.grok][zlda-curated] Relying on default value of `pipeline.ecs_compatibility`, which may change in a future major release of Logstash. To avoid unexpected changes when upgrading Logstash, please explicitly declare your desired ECS Compatibility mode.
[2022-06-08T09:18:46,855][INFO ][logstash.javapipeline ][zlda-curated] Starting pipeline {:pipeline_id=>"zlda-curated", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>1000, "pipeline.sources"=>["/usr/share/logstash/zlda-pipeline-curated/B_cdpz.conf", "/usr/share/logstash/zlda-pipeline-curated/E_transform.conf", "/usr/share/logstash/zlda-pipeline-curated/H_smf30.conf", "/usr/share/logstash/zlda-pipeline-curated/H_smf80_command.conf", "/usr/share/logstash/zlda-pipeline-curated/H_smf80_logon.conf", "/usr/share/logstash/zlda-pipeline-curated/H_smf80_operation.conf", "/usr/share/logstash/zlda-pipeline-curated/H_smf80_resource.conf", "/usr/share/logstash/zlda-pipeline-curated/H_zos_syslog.conf", "/usr/share/logstash/zlda-pipeline-curated/Q_elasticsearch.conf"], :thread=>"#<Thread:0x70c53d70 run>"}
[2022-06-08T09:18:47,817][INFO ][logstash.javapipeline ][zlda-curated] Pipeline Java execution initialization time {"seconds"=>0.96}
[2022-06-08T09:18:47,887][INFO ][logstash.javapipeline ][zlda-curated] Pipeline started {"pipeline.id"=>"zlda-curated"}
[2022-06-08T09:18:47,897][INFO ][logstash.inputs.tcp ][zlda-curated][72fb44da108dda9e2da6c6acabb420ee1319c6533076acd981730432b8de1822] Starting tcp input listener {:address=>"9.30.118.124:8081", :ssl_enable=>false}
[2022-06-08T09:18:47,919][ERROR][logstash.javapipeline ][zlda-curated][72fb44da108dda9e2da6c6acabb420ee1319c6533076acd981730432b8de1822] A plugin had an unrecoverable error. Will restart this plugin.
Pipeline_id:zlda-curated
Plugin: <LogStash::Inputs::Tcp host=>"9.30.118.124", port=>8081, id=>"72fb44da108dda9e2da6c6acabb420ee1319c6533076acd981730432b8de1822", enable_metric=>true, codec=><LogStash::Codecs::Line id=>"line_1cf98935-5bed-4143-a6c4-ad9d93d9a05b", enable_metric=>true, charset=>"UTF-8", delimiter=>"\n">, mode=>"server", proxy_protocol=>false, ssl_enable=>false, ssl_verify=>true, ssl_key_passphrase=><password>, tcp_keep_alive=>false, dns_reverse_lookup_enabled=>true>
Error: Cannot assign requested address
Exception: Java::JavaNet::BindException
Stack: sun.nio.ch.Net.bind0(Native Method)
sun.nio.ch.Net.bind(sun/nio/ch/Net.java:455)
sun.nio.ch.Net.bind(sun/nio/ch/Net.java:447)
sun.nio.ch.ServerSocketChannelImpl.bind(sun/nio/ch/ServerSocketChannelImpl.java:227)
io.netty.channel.socket.nio.NioServerSocketChannel.doBind(io/netty/channel/socket/nio/NioServerSocketChannel.java:134)
io.netty.channel.AbstractChannel$AbstractUnsafe.bind(io/netty/channel/AbstractChannel.java:550)
io.netty.channel.DefaultChannelPipeline$HeadContext.bind(io/netty/channel/DefaultChannelPipeline.java:1334)
io.netty.channel.AbstractChannelHandlerContext.invokeBind(io/netty/channel/AbstractChannelHandlerContext.java:506)
io.netty.channel.AbstractChannelHandlerContext.bind(io/netty/channel/AbstractChannelHandlerContext.java:491)
io.netty.channel.DefaultChannelPipeline.bind(io/netty/channel/DefaultChannelPipeline.java:973)
io.netty.channel.AbstractChannel.bind(io/netty/channel/AbstractChannel.java:248)
io.netty.bootstrap.AbstractBootstrap$2.run(io/netty/bootstrap/AbstractBootstrap.java:356)
io.netty.util.concurrent.AbstractEventExecutor.safeExecute(io/netty/util/concurrent/AbstractEventExecutor.java:164)
io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(io/netty/util/concurrent/SingleThreadEventExecutor.java:472)
io.netty.channel.nio.NioEventLoop.run(io/netty/channel/nio/NioEventLoop.java:500)
io.netty.util.concurrent.SingleThreadEventExecutor$4.run(io/netty/util/concurrent/SingleThreadEventExecutor.java:989)
io.netty.util.internal.ThreadExecutorMap$2.run(io/netty/util/internal/ThreadExecutorMap.java:74)
io.netty.util.concurrent.FastThreadLocalRunnable.run(io/netty/util/concurrent/FastThreadLocalRunnable.java:30)
java.lang.Thread.run(java/lang/Thread.java:834)
....
How can I map the logstash internal docker hostname and port to the ones I have configured in my input plugin? Thanks
In the host
option you can only use an IP address that is available in the container.
You should remove the host
option or set it to 0.0.0.0
so Logstash will bind to the private IP of the container and your docker host will redirect the requests to it.
Hello Leandro,
thanks a lot for your prompt and valuable help!
I have specified
host => "0.0.0.0"
port => 8081
and Logstash can successfully start and I can connect to it.
Thanks really a lot. Bye
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.