我正在尝试使用logstash 6.7将消息发布到rabbitmq。 Logstash给我的错误是拒绝连接到本地主机,我明确提到了远程主机地址。
import glob
import pandas as pd
from matplotlib import pyplot as plt
path = '/path/to/data/files/2015*' #dir has 8 files beginning with 2015
files = glob.glob(path)
fig = plt.figure(figsize=(10,8))
subs, axes = plt.subplots(8, sharex=True)
for i, file in enumerate(files):
f = open(file, 'r')
df = pd.read_csv(f, sep=' ', header=None, )
plt.sca(axes[i])
df.plot(subplots)
plt.show()
但是我能够从kafka中读取消息,并能够提取和转换它们所需的形式。我使用输出文件插件来查看数据。成功了但是尝试连接到Rabbitmq并发布失败。错误消息没有任何意义。有什么可以帮助我的。我做错了什么?
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>"
}
}
}
答案 0 :(得分:0)
找出问题所在。 Logstash文档未更新。
主机参数格式:host-url:port
端口参数不是必需的。