ELK(5):ELK-kibana安装、使用和代理访问

 

ELK(5):kibana安装、使用和代理访问

1             安装

# sudo rpm -ivh  kibana-7.2.0-x86_64.rpm
# sudo rpm -ivh  kibana-7.2.0-x86_64.rpm


警告:kibana-7.2.0-x86_64.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID d88e42b4: NOKEY

准备中...                          ################################# [100%]

正在升级/安装...

   1:kibana-7.2.0-1                   ################################# [100%]

[admin@pe-jira elk]$

 

2             配置文件

server.port: 5601

server.host: "10.6.76.27"

elasticsearch.hosts: ["http://10.6.76.27:9200"] 

#暂时先这样子,再改成127.0.0.1

i18n.locale: zh-CN

#直接调用中文,再不用汉化,666

 

 

3             启动

 

sudo systemctl start kibana

 

 

4             最简单的摸索一下

 

 

 

4.1        添加系统日志

 

 

 

 

 

 

 

 

 

 

 

5             Nginx代理访问kibana 并设置身份验证

Nginx安装我就不写了

把kibana的地址改成127.0.0.1

 

5.1        代理访问

[admin@pe-jira conf]$ cat kibana.conf

upstream kibana_app {

server 127.0.0.1:5601 weight=1 max_fails=2 fail_timeout=30s;

}

server {

        listen 80;

        server_name  kibana.corp.XXX.com;

        location / {

               # proxy_redirect http:// $scheme://;

                #proxy_set_header X-Forwarded-Ssl on;

                proxy_pass  http://kibana_app;

                proxy_next_upstream http_502 http_504 error timeout invalid_header;

                proxy_set_header Host $host;

                proxy_set_header X-Forwarded-For $remote_addr;

                access_log  logs/kibana.log main;

                log_by_lua_file /home/admin/webserver/nginx/conf/conf.d/record.lua;

        }

}

 

 

 

5.2        登陆认证

需要http-tools
yum install -y httpd-tools

 

创建用户名密码

htpasswd -bc /home/admin/webserver/conf/htpasswd.users admin admin

 

#[admin@pe-jira conf]$ cat /home/admin/webserver/conf/htpasswd.users

#admin:$apr1$ml2bzvSu$UGIMC5.ZUlM9/H.VqOuCF/

 

nginx添加配置认证文件

#[admin@pe-jira conf]$ cat kibana.conf

upstream kibana_app {

server 127.0.0.1:5601 weight=1 max_fails=2 fail_timeout=30s;

}

server {

        listen 80;

        server_name  kibana.corp.XXXi.com;

        auth_basic "Restricted Access";

        auth_basic_user_file /home/admin/webserver/conf/htpasswd.users;

        location / {

                #proxy_set_header X-Forwarded-Ssl on;

                proxy_pass  http://kibana_app;

                proxy_next_upstream http_502 http_504 error timeout invalid_header;

                proxy_set_header Host $host;

                proxy_set_header X-Forwarded-For $remote_addr;

                access_log  logs/kibana.log main;

                log_by_lua_file /home/admin/webserver/nginx/conf/conf.d/record.lua;

        }

}

 

 

 

 

posted on 2019-07-16 08:57  光阴8023  阅读(531)  评论(0编辑  收藏  举报