EFK部署centos7.9(三)Kibana部署

系统类型:Centos7.9

节点IP: 192.168.11.140

软件版本:nginx-1.14.2、kibana-6.5.4-linux-x86_64.tar.gz

上传或者下载安装包

Wget https://artifacts.elastic.co/downloads/kibana/kibana-6.5.4-linux-x86_64.tar.gz

tar zvxf kibana-6.5.4-linux-x86_64.tar.gz -C /usr/local/

cd /usr/local/kibana-6.5.4-linux-x86_64/config/

vim kibana.yml     添加或者删除注释都行

server.port: 5601

server.host: "192.168.246.235"     #kibana本机的地址

elasticsearch.url: "http://192.168.11.139:9200" #ES主节点地址+端口

kibana.index: ".kibana"

EFK部署centos7.9(三)Kibana部署_第1张图片

server.port kibana 服务端口,默认5601

server.host kibana 主机IP地址,默认localhost

elasticsearch.url  用来做查询的ES节点的URL,默认http://localhost:9200

kibana.index       kibana在Elasticsearch中使用索引来存储保存的searches, visualizations和dashboards,默认.kibana

cd kibana-6.5.4-linux-x86_64

nohup ./bin/kibana &   启动kibana

安装配置Nginx反向代理

 配置yum源      rpm -ivh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

yum install -y nginx

cd /etc/nginx/conf.d/

cp default.conf nginx.conf

vim nginx.conf

dG   配置文件全删了

然后复制以下配置即可

server {

        listen       80;

        server_name  192.168.11.140;

        #charset koi8-r;

       # access_log  /var/log/nginx/host.access.log  main;

       # access_log off;

         location / {

             proxy_pass http://192.168.11.140:5601;

             proxy_set_header Host $host:5601;

             proxy_set_header X-Real-IP $remote_addr;

             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

             proxy_set_header Via "nginx";

                     }

         location /status {

             stub_status on; #开启网站监控状态

             access_log /var/log/nginx/kibana_status.log; #监控日志

             auth_basic "NginxStatus"; }

         location /head/{

             proxy_pass http://192.168.11.140:9100;

             proxy_set_header Host $host:9100;

             proxy_set_header X-Real-IP $remote_addr;

             proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

             proxy_set_header Via "nginx";

                         }

}

然后配置nginx日志的json格式

vim /etc/nginx/nginx.conf

log_format  json '{"@timestamp":"$time_iso8601",'

                           '"@version":"1",'

                           '"client":"$remote_addr",'

                           '"url":"$uri",'

                           '"status":"$status",'

                           '"domain":"$host",'

                           '"host":"$server_addr",'

                           '"size":$body_bytes_sent,'

                           '"responsetime":$request_time,'

                           '"referer": "$http_referer",'

                           '"ua": "$http_user_agent"'

               '}';

access_log  /var/log/nginx/access_json.log  json;

EFK部署centos7.9(三)Kibana部署_第2张图片

systemctl start nginx  启动nginx

访问192.168.11.140  本机ip或者192.168.11.140:5601

EFK部署centos7.9(三)Kibana部署_第3张图片 

 

 

你可能感兴趣的:(linux,服务器,运维,kibana,EFK)