2016-11-17 258 views
0

我遇到的問題與錯誤logspout寫:連接被拒絕

# logspout v3.2-dev-custom by gliderlabs 
# adapters: raw tcp logstash udp syslog 
# options : persist:/mnt/routes 
# jobs : http[]:80 pump routes 
# routes : 
# ADAPTER  ADDRESS   CONTAINERS  SOURCES OPTIONS 
# logstash 0.0.0.0:5000       map[] 
2016/11/17 07:15:57 logstash: could not write:write udp 127.0.0.1:34146->127.0.0.1:5000: write: connection refused 

後,我開始適配器 sudo docker run --name="logspout" --volume=/var/run/docker.sock:/var/run/docker.sock -e ROUTE_URIS=logstash://0.0.0.0:5000 c045f1a3472b

logstash 5.0泊塢窗容器與日誌

Sending Logstash's logs to /var/log/logstash which is now configured via  log4j2.properties 
07:04:11.987 [[main]-pipeline-manager] INFO logstash.inputs.tcp -   Automatically switching from json to json_lines codec {:plugin=>"tcp"} 
07:04:11.987 [[main]<udp] INFO logstash.inputs.udp - Starting UDP listener {:address=>"0.0.0.0:5000"} 
07:04:12.003 [[main]-pipeline-manager] INFO logstash.inputs.tcp - Starting tcp input listener {:address=>"0.0.0.0:5000"} 
07:04:12.409 [[main]-pipeline-manager] INFO logstash.outputs.elasticsearch - Elasticsearch pool URLs updated {:changes=>{:removed=>[], :added=> ["https://~hidden~:[email protected]:9243"]}} 
07:04:12.410 [[main]-pipeline-manager] INFO logstash.outputs.elasticsearch - Using mapping template from {:path=>nil} 
07:04:13.612 [[main]-pipeline-manager] INFO logstash.outputs.elasticsearch - Attempting to install template {:manage_template=>{"template"=>"logstash-*", "version"=>50001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"_default_"=>{"_all"=>{"enabled"=>true, "norms"=>false}, "dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"*", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword"}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date", "include_in_all"=>false}, "@version"=>{"type"=>"keyword", "include_in_all"=>false}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}} 
07:04:13.705 [[main]-pipeline-manager] INFO logstash.outputs.elasticsearch - New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>["fc4fba7c82d6102f5c1a224f0e9f2e9a.us-east-1.aws.found.io:9243"]} 
07:04:13.710 [[main]-pipeline-manager] INFO logstash.pipeline - Starting pipeline {"id"=>"main", "pipeline.workers"=>1, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>5, "pipeline.max_inflight"=>125} 
07:04:13.717 [[main]-pipeline-manager] INFO logstash.pipeline - Pipeline main started 
07:04:13.802 [Api Webserver] INFO logstash.agent - Successfully started  Logstash API endpoint {:port=>9600} 
運行

我試圖使用logspout和logstash將我的單獨docker容器日誌發送到彈性雲,其中logstash,nginx,web等位於ec2上實例。謝謝您的幫助。

+0

看來你正在嘗試寫入本地主機,當我猜測logstash和logspout在不同的容器中。你能分享一些關於你的設置嗎?撰寫?聯網?每個容器如何運行? – johnharris85

+1

嘿@ johnharris85!感謝您指引我走向正確的方向。是的,錯誤是將它寫在主機上而不是logstash容器上。使用遺留鏈接2個容器解決了問題。剛剛用兩個容器創建了docker-compose.yml並解決了問題。再次感謝。 –

回答

0

當在單獨的容器中運行logstash和logspout時,我有同樣的確切問題。在我的情況下,logspout試圖在logstash準備好之前寫入logstash,這導致logspout容器出錯,然後崩潰。它已通過將RETRY_SEND環境變量添加到docker-compose文件中的logspout服務中解決。