我使用命令docker-compose up来部署所有的docker机器。这很好用,但是当我停止所有docker实例并手动重启时,我遇到了logstash的问题:
{:timestamp=>"2016-07-12T08:06:11.710000+0000", :message=>"Pipeline main started"}
{:timestamp=>"2016-07-12T08:06:11.815000+0000", :message=>"Pipeline main has been shutdown"}
{:timestamp=>"2016-07-12T08:06:14.723000+0000", :message=>"stopping pipeline", :id=>"main"}
{:timestamp=>"2016-07-12T08:07:47.582000+0000", :message=>"Pipeline main started"}
{:timestamp=>"2016-07-12T08:07:47.692000+0000", :message=>"Pipeline main has been shutdown"}
{:timestamp=>"2016-07-12T08:07:50.585000+0000", :message=>"stopping pipeline", :id=>"main"}
因此,当我在kubernetes中部署并且无法使用docker-compose时,我遇到同样的问题。
答案 0 :(得分:0)
我刚遇到类似的问题。
没有-ti
# docker run --rm logstash:2.3.4 logstash --debug --verbose -e 'input { stdin { } } output { stdout { } }'
{:timestamp=>"2016-08-03T03:24:48.618000+0000", :message=>"starting agent", :level=>:info}
{:timestamp=>"2016-08-03T03:24:48.629000+0000", :message=>"starting pipeline", :id=>"main", :level=>:info}
{:timestamp=>"2016-08-03T03:24:48.816000+0000", :message=>"Starting pipeline", :id=>"main", :pipeline_workers=>1, :batch_size=>125, :batch_delay=>5, :max_inflight=>125, :level=>:info}
{:timestamp=>"2016-08-03T03:24:48.827000+0000", :message=>"Pipeline main started"}
{:timestamp=>"2016-08-03T03:24:48.848000+0000", :message=>"Input plugins stopped! Will shutdown filter/output workers.", :level=>:info}
{:timestamp=>"2016-08-03T03:24:48.953000+0000", :message=>"Pipeline main has been shutdown"}
{:timestamp=>"2016-08-03T03:24:51.834000+0000", :message=>"stopping pipeline", :id=>"main"}
{:timestamp=>"2016-08-03T03:24:51.843000+0000", :message=>"Closing inputs", :level=>:info}
{:timestamp=>"2016-08-03T03:24:51.844000+0000", :message=>"Closed inputs", :level=>:info}
使用-ti
# docker run -ti --rm logstash:2.3.4 logstash --debug --verbose -e 'input { stdin { } } output { stdout { } }'
starting agent {:level=>:info}
starting pipeline {:id=>"main", :level=>:info}
Settings: Default pipeline workers: 1
Starting pipeline {:id=>"main", :pipeline_workers=>1, :batch_size=>125, :batch_delay=>5, :max_inflight=>125, :level=>:info}
Pipeline main started
^CSIGINT received. Shutting down the agent. {:level=>:warn}
stopping pipeline {:id=>"main"}
Closing inputs {:level=>:info}
Closed inputs {:level=>:info}
^CSIGINT received. Terminating immediately.. {:level=>:fatal}
您似乎没有stdin
之外的任何已配置输入。
因此,如果您使用composer启动它,则必须设置tty: true
# cat docker-compose.yml
version: '2'
services:
logstash:
image: logstash:2.3.4
command: logstash --verbose --debug
tty: true
结果将是
# docker logs -f sync_logstash_1
starting agent {:level=>:info}
starting pipeline {:id=>"main", :level=>:info}
Settings: Default pipeline workers: 1
Starting pipeline {:id=>"main", :pipeline_workers=>1, :batch_size=>125, :batch_delay=>5, :max_inflight=>125, :level=>:info}
Pipeline main started