Невозможно подключиться к кролику MQ с помощью logstash - PullRequest
0 голосов
/ 08 апреля 2019

Я пытаюсь опубликовать сообщение на rabbitmq, используя logstash 6.7.Logstash дал мне сообщение об ошибке, отказавшись от подключения к localhost, где я явно упомянул адрес удаленного хоста.

input {
  kafka {
    id => "metrics.all"
    bootstrap_servers => "kafka-host:6000"
    group_id => "group_1"
    security_protocol => "SSL"
    ssl_truststore_location => "truststore.jks"
    ssl_keystore_location => "keystore.jks"
    ssl_keystore_password => "password"
    ssl_key_password => "password"
    topics => "metrics.all"
    ssl_endpoint_identification_algorithm => ""
  }
}

filter {
  json {
    source => "message"
    target => "sample"
  }

  split {
    field => "[sample][contents][metrics][data]"
    target => "metric"
  }

  if [metric][app] != "appMetrics" {
    drop {}
  }

  if ".d.percentile-99" not in [metric][metric] {
    drop {}
  }

  mutate {
    gsub => ["[metric][metric]", ".d.percentile-99", ""]
  }
}

output {
  rabbitmq {
    id => "out.metrics.all"
    host => "rmq-host-url.com"
    port => 3000
    exchange => "rmq.exchange.metrics"
    exchange_type => "direct"
    vhost => "rmq-metrics"
    user => "rmq-metrics"
    password => "rmq-metrics"
    key => "metrics"
    durable => true
    automatic_recovery => true
    heartbeat => 0
    message_properties => {
      "content_encoding" => "RAW"
    }

    codec => line {
      format => "<?xml version='1.0' encoding='UTF-8'?>
                 <stats>
                   <as_of_ts>%{[sample][output_time]}</as_of_ts>
                   <metric>%{[metric][metric]}</metric>
                   <client>9002</client>
                   <value>%{[metric][value]}</value>
                 </stats>"
    }
  }
}

Но я умею читать сообщения от кафки и могу извлекать и преобразовывать их в желаемую форму.Я использовал плагин выходного файла, чтобы увидеть данные.Это было успешно.Но попытка подключиться к rabbitmq и опубликовать не удалась.сообщение об ошибке не имеет никакого смысла.может мне помочь.что я сделал не так?

[2019-04-08T13:46:05,564][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2019-04-08T13:46:05,621][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.7.0"}
[2019-04-08T13:46:23,905][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>20, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2019-04-08T13:46:24,305][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}
[2019-04-08T13:46:25,353][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}
[2019-04-08T13:46:26,370][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}
[2019-04-08T13:46:27,378][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}
[2019-04-08T13:46:28,385][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}
[2019-04-08T13:46:29,393][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}
[2019-04-08T13:46:30,403][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}
[2019-04-08T13:46:31,412][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}
[2019-04-08T13:46:32,422][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}
[2019-04-08T13:46:33,430][ERROR][logstash.outputs.rabbitmq] RabbitMQ connection error, will retry. {:error_message=>"Connection to localhost:5672 refused", :exception=>"MarchHare::ConnectionRefused"}

1 Ответ

0 голосов
/ 10 апреля 2019

Узнайте проблему. Документация Logstash не обновляется.

Формат параметра хоста: host-url: порт

Параметр порта не обязателен.

...