青岛城乡建设部网站首页,c 手机网站开发工具,做跨境电商网站的意义,做网站准备内容1.graylog配置输出
在System-outputs#xff0c;选择GELF Output#xff0c;填写如下内容#xff0c;其它选项默认 在要输出的Stream中#xff0c;选择Manage Outputs 选择GELF Output#xff0c;右边选择刚才创建好的test。
2.安装logstash#xff0c;作为中间临时…1.graylog配置输出
在System-outputs选择GELF Output填写如下内容其它选项默认 在要输出的Stream中选择Manage Outputs 选择GELF Output右边选择刚才创建好的test。
2.安装logstash作为中间临时的搬运工
下载logstash最新版就可以。
https://www.elastic.co/cn/downloads/logstash/上传到服务器编写test.conf配置文件内容如下
input{gelf {port 12201codec jsonhost 0.0.0.0}
}output{kafka{bootstrap_servers [kafkaserver1:9092,kafkaserver2:9092,kafkaserver3:9092]topic_id test-kafkacodec json}}运行logstash输入以下命令
bin/logstash -f test.conf3.kafka
前提安装好kafka集群 创建topic
bin/kafka-topics.sh --bootstrap-server kafkaserver1:9092,kafkaserver2:9092,kafkaserver3:9092 --create --topic test-kafka监听topic
bin/kafka-console-consumer.sh --bootstrap-server kafkaserver1:9092,kafkaserver2:9092,kafkaserver3:9092 --topic test-kafka最终消息传递到kafka上
filebeat配置
也可以使用filebeat将日志转发到kafka中原理一样
- type: syslogenabled: trueprotocol.udp:host: 0.0.0.0:12201 端口与graylog-outputs一致fields:logResource: testkafka #这些都是附加的标签fields_under_root: true #将标签放到顶头不然在message字段里output.kafka:enabled: truehosts: [kafkaserver1:9092,kafkaserver2:9092,kafkaserver3:9092]topic: %{[logResource]}required_acks: 13.graylog插件
插件下载
https://codeload.github.com/asnowfox/graylog-kafka-output/zip/refs/heads/master
使用mvn package编译成jar包放入到plugin目录下重启graylog