当前位置: 首页 > news >正文

牡丹江3d网站开发通讯员队伍建设与网站新闻管理

牡丹江3d网站开发,通讯员队伍建设与网站新闻管理,绚丽的网站,最受欢迎的公众号排行榜ELK框架Logstash配合Filebeats和kafka使用 本文目录 ELK框架Logstash配合Filebeats和kafka使用配置文件结构input为标准输入,output为标准输出input为log文件output为标准输出output为es input为tcpspringboot配置logstash配置 input为filebeatsfilebeats配置logsta…

ELK框架Logstash配合Filebeats和kafka使用

本文目录

    • ELK框架Logstash配合Filebeats和kafka使用
      • 配置文件结构
      • input为标准输入,output为标准输出
      • input为log文件
        • output为标准输出
        • output为es
      • input为tcp
        • springboot配置
        • logstash配置
      • input为filebeats
        • filebeats配置
        • logstash配置
      • input为kafka
        • filebeats设置
        • logstash配置

配置文件结构

配置文件为:logstash.yml

需要自己新建conf文件,设置inputfilteroutput,文件结构如下,自带的logstash-sample.conf内容如下

input { }
filter {}
output {}

启动命令

bin/logstash -f config/logstash.conf

https://www.elastic.co/guide/en/logstash/current/input-plugins.html

input为标准输入,output为标准输出

input { stdin { } 
}
output {elasticsearch { hosts => ["localhost:9200"] }stdout { }
}

input为log文件

output为标准输出

input {# 从文件读取日志信息file {path => "/xxx/demolog/logs/myapp-info.log"type => "ghn"start_position => "beginning"}}output {stdout { codec => rubydebug }
}

output为es

input {# 从文件读取日志信息file {path => "/xxx/demolog/log/demolog-*.log"type => "ghn"start_position => "beginning"}}output {# 输出到 elasticsearchelasticsearch {hosts => ["localhost:9200"] user => "elastic"password => "xxxxxx"ssl => "true"cacert => "/xxx/elk/logstash-8.9.1/config/certs/http_ca.crt"index => "ghn-%{+YYYY.MM.dd}"}stdout {  }
}

input为tcp

配合springboot/springcloud使用

springboot配置

官方github:https://github.com/logfellow/logstash-logback-encoder
在pom.xml添加依赖

        <dependency><groupId>net.logstash.logback</groupId><artifactId>logstash-logback-encoder</artifactId><version>7.4</version></dependency>

在logback-spring.xml添加配置

    <appender name="stash" class="net.logstash.logback.appender.LogstashTcpSocketAppender"><destination>127.0.0.1:4560</destination><!-- encoder is required --><encoder class="net.logstash.logback.encoder.LogstashEncoder" /></appender><root level="info"><appender-ref ref="CONSOLE"/><appender-ref ref="stash" /></root>

logstash配置

input {# 从文件读取日志信息tcp {host => "0.0.0.0"mode => "server"port => 4560codec => json_lines}}output {# 输出到 elasticsearchelasticsearch {hosts => ["localhost:9200"] user => "elastic"password => "xxxxxx"ssl => "true"cacert => "xxx/logstash-8.9.1/config/certs/http_ca.crt"index => "ghn-%{+YYYY.MM.dd}"}stdout { }# stdout { codec => rubydebug }
}
  • logstash终端查看

  • kibana查看

input为filebeats

filebeats配置

  • 配置文件位置:filebeat-8.9.1-darwin-aarch64/filebeat.yml,修改如下部分,指定log位置为springboot的目录
filebeat.inputs:
- type: filestreamenabled: truepaths:- /xxx/xxx/*.log
  • 启动
./filebeat -e -c filebeat.yml -d "publish"

与logstash建立了连接,启动成功

logstash配置

input {beats {port => 5044}
}output {elasticsearch {hosts => ["localhost:9200"] user => "elastic"password => "xxxxxx"ssl => "true"cacert => "/xxxx/logstash-8.9.1/config/certs/http_ca.crt"index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"}
}
  • 启动logstash
bin/logstash -f config/logstash-filebeat.conf
  • 获取从filebeats发来的日志

kibana

  • kibana中数据视图已经能够看到

  • 查看详情

input为kafka

官方文档:https://www.elastic.co/guide/en/logstash/current/use-filebeat-modules-kafka.html

filebeats设置

output.kafka:hosts: ["localhost:9092"]topic: "filebeat"codec.json:pretty: false
./filebeat -e -c filebeat.yml -d "publish"

logstash配置

input {kafka {bootstrap_servers => ["localhost:9092"]topics => ["filebeat"]codec => json}}output {# 输出到 elasticsearchelasticsearch {hosts => ["localhost:9200"] user => "elastic"password => "xxxxxx"ssl => "true"cacert => "/xxx/elk/logstash-8.9.1/config/certs/http_ca.crt"index => "ghn-%{+YYYY.MM.dd}"}stdout { }# stdout { codec => rubydebug }
}
  • kafka启动

  • logstash查看

  • kafka关闭

https://www.elastic.co/guide/en/logstash/current/plugins-inputs-kafka.html

http://www.15wanjia.com/news/159894.html

相关文章:

  • asp.net 大网站crm平台
  • 做我女朋友的套路网站商洛网站建设求职简历
  • 舟山高端网站设计定制网站开发冬天里的白玫瑰
  • 怎么通过贷款网站找做贷款客户成华区微信网站建设推
  • 网站开发服务转包合同证券公司怎么拉客户
  • 网站建设推广哪家专业在本地服务器上建设网站的步骤
  • 建立网站成本最低长春广告公司网站建设
  • 竞价在什么网站上做北京十大网站建设公司
  • 那些网站专门做棋牌推广的widgetkit wordpress
  • 站长天猫建设网站的理由
  • 烟台电商网站建设昆明网站制作定制公司
  • 网站备案主体注销东莞网站建设那家专业
  • 校园微网站建设方案ppt模板莆田网站制作公司
  • 网站建设年度计划哪里有做网站服务商
  • 写网站编程需要什么网站自主建站
  • 设计网站设计原则如何识别一个网站是否做的好
  • 建设网站视频教程微信一键登录网站怎么做
  • 福田网站建设福田网站设计网站设计网站机构
  • 网站不显示域名解析错误怎么办网站空间空间租赁
  • 如何更改网站图标河北沧州做网站的电话
  • 贵州网站建设三合一网站cms
  • 如何阿里网站建设固戍网站建设
  • 网站虚拟主机空间1g多吗广州做网站哪个好
  • 哪种语言做的网站好电子商务网站建设可用性
  • 开源网站后台网上创建公司
  • 服务器主机管理系统建好后如何用它搭建网站广西自治区集约化网站建设要求
  • 网站开发项目怎么接传媒网站设计
  • 哪家公司做网站网站建设工作成果怎么写
  • 容桂网站制作价位聊城网站建设售后服务
  • 攻略类型网站如何做产品营销专业的免费建站