日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

logstash使用中遇到的问题

發(fā)布時間:2024/2/28 编程问答 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 logstash使用中遇到的问题 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

文章目錄

    • 1. 在logstash中配置es的域名無法使用
    • 2. logstash.yml配置不生效

1. 在logstash中配置es的域名無法使用

output {elasticsearch {hosts => ["http://estest_hostmy.com:10200"]index => "%{[@metadata][index_0]}-%{+YYYY.MM.dd}"} }

報錯如下

17378 [2018-11-22T15:46:00,659][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://:9200/][Manticore::ClientProtocolException] URI does not specify a valid host name: http:/"}17379 [2018-11-22T15:46:05,660][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://:9200/, :path=>"/"}17380 [2018-11-22T15:46:05,660][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://:9200/, :path=>"/"}17381 [2018-11-22T15:46:05,660][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://:9200/, :path=>"/"}17382 [2018-11-22T15:46:05,660][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://:9200/, :path=>"/"}17383 [2018-11-22T15:46:05,660][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://:9200/, :path=>"/"}17384 [2018-11-22T15:46:05,660][WARN ][logstash.outputs.elasticsearch] Attempted to resurrect connection to dead ES instance, but got an error. {:url=>"http://:9200/", :error_type=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :error=>"Elasticsearch Unreachable: [http://:9200/][Manticore::ClientProtocolException] URI does not specify a valid host name: http:/"}

一度以為就是logstash不支持域名配置。
但是logstash的官網(wǎng)介紹的是 type 為uri 鏈接

hosts
Value type is uri
Default value is [//127.0.0.1]
Sets the host(s) of the remote instance. If given an array it will load balance requests across the hosts specified in the hosts parameter. Remember the http protocol uses the http address (eg. 9200, not 9300). “127.0.0.1” [“127.0.0.1:9200”,“127.0.0.2:9200”] [“http://127.0.0.1”] [“https://127.0.0.1:9200”] [“https://127.0.0.1:9200/mypath”] (If using a proxy on a subpath) It is important to exclude dedicated master nodes from the hosts list to prevent LS from sending bulk requests to the master nodes. So this parameter should only reference either data or client nodes in Elasticsearch.
Any special characters present in the URLs here MUST be URL escaped! This means # should be put in as %23 for instance.

??左思右想覺得不太對勁,后來想到查到logstash的 output-elasticsearch-plugin的官方github,通過一個issue 才發(fā)現(xiàn)原來是我對域名配置不夠熟悉(在這個issue看到一半的時候以為是logstash的 logstash-output-elasticsearch 插件版本問題,打臉,以后要看完),域名里面的規(guī)范是不能有下劃線(_)的。
??看來最基本的知識有時候不牢固會造成很多問題,一定要有質(zhì)疑能力,還好看了es的官網(wǎng)是可以配置url的,所以堅持查了查,要不然估計就認(rèn)知錯誤了。坑。要多學(xué)習(xí),孩砸。

修改為下面的方式就ok了

output {elasticsearch {hosts => ["http://estes-thostmy.com:10200"]index => "%{[@metadata][index_0]}-%{+YYYY.MM.dd}"} }

github issue 鏈接

2. logstash.yml配置不生效

在logstash.yml中配置監(jiān)控數(shù)據(jù)收集到es當(dāng)中,但是一直不生效,數(shù)據(jù)無法進(jìn)入到es當(dāng)中,根據(jù)實際經(jīng)驗,類似下面配置沒有問題。

path.data: /home/dev/logstash/logstash_dataconfig.reload.interval: 3sdead_letter_queue.enable: falsehttp.port: 9600-9700xpack.monitoring.enabled: truexpack.monitoring.elasticsearch.username: "logstash_system"xpack.monitoring.elasticsearch.password: "d1Acosm6Eo"xpack.monitoring.elasticsearch.hosts: "http://uc-k8s3:9200"xpack.monitoring.collection.pipeline.details.enabled: true

??后來猛然想起來是yml的格式有問題,因為配置項提交多,注釋項也很多(最開始上面的配置中夾雜了很多其他注釋),發(fā)現(xiàn)是因為前面的一些配置和后面的配置沒有按照yml格式對齊,刪掉所有的注釋性文字,整理成上面就可以了

總結(jié)

以上是生活随笔為你收集整理的logstash使用中遇到的问题的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。