ELK系统日志管理搭建
source link: https://www.itwork.club/2022/04/20/install-elk/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
ELK系统日志管理搭建
Apr 20, 2022ELK4点击
elk搭建基于linux系统,版本需要保持一致。
安装Elasticsearch
elasticsearch
在 ELK
作为日志的存储介质。
下载完成,放到linux系统指定的位置,如:/home/elasticsearch
,如下:
mkdir elasticsearch
cd elasticesearch
tar -zxvf '解压下载好的elasticsearch安装包'
修改配置文件 config/elasticsearch.yml
vim config/elasticsearch.yml
# 修改如下参数
cluster.name: es-application
path.data: /home/elasticsearch/data
path.logs: /home/elasticsearch/logs
network.host: 0.0.0.0
http.port: 9200
bin/elasticsearch -d
注:elasticsearch不允许root用户启动,需要创建普通用户
浏览器访问 http:elasticsearch:9200
elasticsearch的地址,可以看到如下信息。
{
name: "qkJVOur",
cluster_name: "es-application",
cluster_uuid: "tnQsvj3SR3O-b2z49FqnqA",
version: {
number: "6.2.4",
build_hash: "ccec39f",
build_date: "2018-04-12T20:37:28.497551Z",
build_snapshot: false,
lucene_version: "7.2.1",
minimum_wire_compatibility_version: "5.6.0",
minimum_index_compatibility_version: "5.0.0"
},
tagline: "You Know, for Search"
}
安装kibana
kibana
在 ELK
中是作为图形界面来查看日志的工具。
下载完成把安装包放到指定的位置,如下:/home/kibana
,如下:
mkdir kibana
cd kibana
tar -zxvf '解压下载好的kibana安装包'
修改配置文件 config/kibana.yml
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.url: "http://localhost:9200" # elasticsearch的地址
i18n.defaultLocale: "zh-CN"
nohup bin/kibana &
浏览器访问 http:kibana:5601
,图形界面配置。
安装logstash
logstash
在 ELK
中是传输、过滤、输出日志。
下载完成把安装包放到指定的位置,如下:/home/logstash
,如下:
mkdir logstash
cd logstash
tar -zxvf '解压下载好的logstash安装包'
创建文件config/logstash.conf
input {
beats {
port => 5044
codec => plain {
charset => "UTF-8"
}
}
}
output {
elasticsearch {
hosts => ["127.0.0.1:9200"]
index => "test-all-%{+YYYY.MM.dd}"
}
}
nohup bin/logstash -f config/logstash.conf &
logstash
详细配置请查看这里
安装filefeat
filebeat
需要部署到产生日志的服务器上,有几台部署了服务,都需要在上面安装,用来收集日志,传输到 logstash
.
下载完成把安装包放到指定的位置,如下:/home/filebeat
,如下:
mkdir filebeat
cd filebeat
tar -zxvf '解压下载好的filebeat安装包'
修改配置文件 filebeat.yml
filebeat.prospectors:
- type: log
enabled: true
paths:
- /var/log/*log
output.logstash:
hosts: ["logstash的地址:5044"]
filebeat
详细配置请查看这里
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK