なお、異常と経験ポイントLogtash

なお、異常と経験ポイント1.Logtash

1.1 logstash使用カフカプラグと統合されたES

もしlogstash使用カフカESインとの統合、プラグインのパラメータを設定しなければならないカフカsession_timeout_ms =>「10000」max_poll_records =>「500」これらの2つの値の場合は高すぎる繰り返しES消費につながるされ、カフカオフセット・ドリフトで増加されることはありません

私の本番環境のプルカフカのプロファイルを一覧表示します

个人认为还有待优化。。。
[www@logstash001 config]$ cat logstash-game-kafka.conf 
input {
  kafka {
    id => "game-kafka-input"
    bootstrap_servers => ["10.10.147.43:9092"]
    group_id => "logstash"
    topics => ["java-error", "java-info"]
    codec => "json"
    #auto_offset_reset => "latest"
  }
}

filter {
  json {
    source => "message"
    remove_field => [ "message" ]                                                                                                                                                                                                                
  }

  if [jv_class] == "RocketmqClient" or [jv_method] == "sendHeartbeatToAllBroker" {
    drop { }
  }

  if [jv_message] =~ "The requested url:.*.ico" { drop { } }

  mutate {
    remove_field => ["@version","[beat][name]","[beat][version]","[beat][hostname]"]
  }

  if "beats_input_codec_json_applied" in [tags] {
    mutate {
      remove_tag => ["beats_input_codec_json_applied"]
    }
  }

  date {
    match => [ "jv_time" ,"ISO8601" ]
  }

  mutate {
      gsub => [
          "nx_upstream_host", "-", "0",
          "nx_upstream_time", "-", "0",
          "nx_upstream_status", "-", "0",
          "nx_upstream_connect_time", "-", "0"
      ]
  }
  mutate {
    convert => {"nx_upstream_time"=>"float"}
    convert => {"nx_upstream_response_length"=>"integer"}
    convert => {"nx_upstream_connect_time"=>"float"}
  }
}

output {
  elasticsearch {
    hosts => ["http://10.10.147.36:9200","http://10.10.147.37:9200","http://10.10.147.38:9200","http://10.10.147.46:9200","http://10.10.147.47:9200"]
    user => xxxxxxxxxxxxxxxxx
    password => "xxxxxxxxxxxxxxxxxxxx"
    index => "game-%{lb_log_type}-%{+YYYY.MM.dd}--"
  }
}

1.2「応答コードで失敗しましたアクションを再試行:429

バルク・オペレーションキューがいっぱいになっている、または小さなflush_sizeの値を調整したり、スレッドがthreadpool.bulk.queue_sizeを高めるために増加Elasticsearchキュースレッドプール設定ファイルの大部分をelasticsearch高めるためLogstashプロンプトなどAの間違いがある:1000

1.3 logstash遅いデータ挿入効率ES

バッチサイズの設定ファイルやパイプラインの労働者のパラメータを増加し、

私は、本番環境の設定の一部を記載されています

[www@logstash001 config]$ cat logstash.yml 
# Settings file in YAML
path.data: /data/www/logstash

pipeline.workers: 32 
#pipeline 线程数
#pipeline.output.workers: 16
#
pipeline.batch.size: 50000
#每次发送的事件数
pipeline.batch.delay: 5
#发送延时



config.reload.automatic: true
config.reload.interval: 10s

log.level: info
path.logs: /log/logstash

xpack.monitoring.enabled: true
xpack.monitoring.elasticsearch.hosts: ["http://xxx.xxx.xxx.xxx:9200"]
xpack.monitoring.elasticsearch.username: "xxxxxxxxxx"
xpack.monitoring.elasticsearch.password: "xxxxxxxxxxxxxxx"

1.4ルビーフィルタ機能

logstash5.0値とルビー例を使用して設定値:コード=> "event.set( 'server_time'、Time.now())は、" 現在の値server_time現在のタイムコード=>「event.get( 'server_time')を設定しますイベント[ 'server_time' "現在値server_time現在のタイムコード=>設定する")をイベント[ 'SE、rver_time'] = Time.now(。: "コード=> logstash5.0 server_timeルビー列子取得した値を使用する前に"。 ]「server_time値を取得

1.5自動グループクリオ-consr-BIZ-GO1に失敗しましたコミットオフセット:

报错提示:
Commit cannot be completed since the group has already rebalanced and assigned the partitions to another member. This means that the time between subsequent calls to poll() was longer than the configured session.timeout.ms, which typically implies that the poll loop is spending too much time message processing. You can address this either by increasing the session timeout or by reducing the maximum size of batches returned in poll() with max.poll.records.

パーティションの再配布を完了することができ、消費者のグループオフセット失敗を提出してください。オンライン説明:消費者データはカフカに戻ることができなかったオフセットの前に、この問題がハングアップセッションで、その結果、セッションタイムアウトカフカセットの終わりを超えて、限られた時間のためlogstashすべての消費データので終了し、されていません。エンドカフカは消費データを考慮に正しくない、再パーティション。再確立し、消費者があるためオフセット再送「消費者の失敗」の前に問題のデータを引き出し、およびデータますカフカ最後になるまで、タイムアウト後logstashエンド。session.timout.msのmax.poll.recordsの値を増減させるソリューション。注session.timout.msは同僚もrequest.timeout.msパラメータを増やすの増加、それはrequest.timeout.msのsession.timeout.ms未満であります

我在kafka 的配置文件增加了上面说的参数:
[www@kafkasrv001 config]$ pwd 
/data/soft/kafka/config
[www@kafkasrv001 config]$ vim consumer.properties 
session.timout.ms=7000
[www@kafkasrv001 config]$ pwd 
/data/soft/kafka/config

[www@kafkasrv001 config]$ vim producer.properties 
request.timeout.ms=10000

1.6は、使用マシン上のhostsファイルを変更するために覚えておく必要があります!

それ以外の場合は、カフカが接続できない状況が作成されます。そのため、いくつかのケースでは、直接接続は、ホスト名に使用されます。

logstashに1.7 filebeatデータ

Filebeatフィールド定義されたすべての文字列型であり、その後、カフカlogstashに入り、カフカのフィールドは自動的に変換の種類を識別します


1.8と同様に投稿

おすすめ

転載: www.cnblogs.com/passzhang/p/12402666.html