elk日志监控搭建
centos7系统
1. 检查系统是否已安装java环境:java -version
2. elk官网下载解压
配置启动
- 使用默认配置启动es
./bin/elasticsearch &
测试是否启动成功curl 'http://localhost:9200/?pretty'
- 配置 logstash,在config目录下穿件conf.d文件夹用来存放配置文件,启动
./bin/logstash --path.settings ./config/ -f ./config/conf.d &
- 配置 filebeat 目录下的filebeat.yml文件,启动
nohup ./filebeat -e -c filebeat.yml >/dev/null 2>&1 &
- kibana 启动
./bin/kibana &
- 使用nginx对kibana反向代理、添加登录限制。
监控报警 kibana插件sentinl
现在对应的sentinl版本
指定文件路径安装 ./kibana-plugin install file:///sentinl-v6.2.4.zip
kibana 配置nginx授权登录
- 安装密码生产工具
yum install httpd-tools
- 生成密码文件
sudo htpasswd -bc /opt/nginx/conf/htpasswd.kibana admin admin
- 配置nginx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15server {
listen 5602;
server_name youname; #主机名
location / {
proxy_pass http://localhost:5601;
auth_basic "Basic Authentication";
auth_basic_user_file "/path/htpasswd.kibana"; #密码文件位置
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}重启nginx