音乐播放器
Great Wei
 
文章 标签
16

Powered by Gridea | Theme: Fog

Elk

pm2 安装

npm install pm2 -g

elasticsearch-7.3.1安装

下载地址:https://www.elastic.co/cn/downloads/elasticsearch
修改配置文件elasticsearch-7.3.1/config/elasticsearch.yml 修改实例名称,节点名称,ip与端口。
启动实例执行 ./bin/elasticsearch -d ( -d参数是将程序挂在后台运行),访问ip:端口,返回结果如下图,说明已经启动成功。

logstash-7.3.0安装

下载地址:https://www.elastic.co/cn/downloads/logstash
修改配置文件logstash-7.3.0/filebeat.conf, 配置内容主要是logstash通过接收filebeat传输的数据,格式化数据后,发送到es,分为三部分配置。

第一部分 接收数据端口配置
input {
    beats {
        port => 5044
    }
}
指定logstash服务开放的端口。

第二部分 格式化数据配置
filter {
    ...
}
date{
    match => ["date", "yyyyMMdd HH:mm:ss"]
    target => "@timestamp"
}
这里的grok匹配根据自己项目需求修改。
因此这里需要搭配filebeat一起使用,需要通过filebeat将日志发送到logstash。
filebeat.conf

第三部分 发送至es配置
output {
    elasticsearch {
        hosts => ["10.11.0.109:9200"]
        index => "logstash-%{[fields][index]}-%{+YYYY.MM.dd}"
    }
}

启动实例 pm2 start ./bin/logstash

kibana-7.3.0-linux-x86_64安装

下载地址:https://www.elastic.co/cn/downloads/kibana
修改配置文件kibana-7.3.0-linux-x86_64/config/kibana.yml,server.host配置kibana服务访问ip,server.port配置服务端口,默认5601,
elasticsearch.host配置es实例地址,i18n.locale: "zh-CN" 配置kibana界面显示语言。
启动 pm2 start ./bin/kibana,pm2 log kibana查看日志检查服务是否启动,检查无误访问ip:端口。

filebeat-7.4.2-linux-x86_64安装

下载地址:https://www.elastic.co/cn/downloads/beats/filebeat
修改配置文件filebeat,yml,每个模块就相当一个项目,根据自己需求配置,模块名称。索引名称.
- type: log
    enabled: true
    paths:
    - /home/q/system/atom/runtime/community/logs/access_*
    fields:
       index: atom_access
        modules: community
然后将日志发送到logstash    

 output.logstash:
 # The Logstash hosts
 hosts: ["10.11.0.109:5044"]  
启动 pm2 start ./filebeat, pm2 log filebeat 查看日志检查服务是否启动。

请到客户端“主题--自定义配置--配置”中填入leancloud_appID和key