ELK3——kibana

ELK3------kibana

一、kibana介绍

Kibana是一个开源的可视化平台,可以为ElasticSearch集群的管理提供友好的Web界面,帮助汇总,分析和搜索重要的日志数据。

二、kibana部署

1、在kibana服务器(这里是es1)上安装kibana
powershell 复制代码
[root@es1 ~]# rz -E
rz waiting to receive.
[root@es1 ~]# ls
anaconda-ks.cfg  Downloads                kibana-6.5.2-x86_64.rpm  Public
Desktop          elasticsearch-6.5.2.rpm  Music                    Templates
Documents        initial-setup-ks.cfg     Pictures                 Videos
[root@es1 ~]# rpm -ivh kibana-6.5.2-x86_64.rpm 
warning: kibana-6.5.2-x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:kibana-6.5.2-1                   ################################# [100%]
2、修改配置文件
powershell 复制代码
[root@es1 ~]# cd /etc/kibana/
[root@es1 kibana]# ls
kibana.yml
[root@es1 kibana]# vim kibana.yml 
[root@es1 kibana]# cat /etc/kibana/kibana.yml | grep -v '#' | grep -v '^$'
server.port: 5601                                                //端口
server.host: "0.0.0.0"                                           //监听所有,允许所有人能访问
elasticsearch.url: "http://192.168.100.20:9200"                  //ES集群的路径
logging.dest: /var/log/kibana.log                        //这里加了kibana日志,方便排错与调试

//日志要自己建立,并修改owner和group属性
[root@es1 kibana]# cd
[root@es1 ~]# touch /var/log/kibana.log
[root@es1 ~]# chown kibana.kibana /var/log/kibana.log 
3、启动kibana服务
powershell 复制代码
[root@es1 ~]# systemctl restart kibana.service 
[root@es1 ~]# systemctl enable kibana.service 
Created symlink from /etc/systemd/system/multi-user.target.wants/kibana.service to /etc/systemd/system/kibana.service.
[root@es1 ~]# lsof -i:5601
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
node    10125 kibana   11u  IPv4  60599      0t0  TCP *:esmagent (LISTEN)
4、浏览器访问 http://kibana服务器IP:5601
5、汉化
powershell 复制代码
[root@es1 ~]# rz -E
rz waiting to receive.
[root@es1 ~]# ls
anaconda-ks.cfg  elasticsearch-6.5.2.rpm       Music      Videos
Desktop          initial-setup-ks.cfg          Pictures
Documents        kibana-6.5.2-x86_64.rpm       Public
Downloads        Kibana_Hanization-master.zip  Templates
[root@es1 ~]# unzip Kibana_Hanization-master.zip -d /usr/local
Archive:  Kibana_Hanization-master.zip
88b5f8cef28a720f27a5cb327c906554fbdff7ed
   creating: /usr/local/Kibana_Hanization-master/
  inflating: /usr/local/Kibana_Hanization-master/README.md  
   creating: /usr/local/Kibana_Hanization-master/config/
 ......
 ......
[root@es1 ~]# cd /usr/local
[root@es1 local]# ls
bin  games    Kibana_Hanization-master  lib64    sbin   src
etc  include  lib                       libexec  share
[root@es1 local]# cd Kibana_Hanization-master/
[root@es1 Kibana_Hanization-master]# ls
config  image  main.py  README.md  requirements.txt
[root@es1 Kibana_Hanization-master]# python main.py /usr/share/kibana/
文件[/usr/share/kibana/node_modules/x-pack/plugins/monitoring/ui_exports.js]已翻译。
文件[/usr/share/kibana/node_modules/x-pack/plugins/monitoring/public/register_feature.js]已翻译。
......
......
恭喜,Kibana汉化完成!
//再次启动服务
[root@es1 Kibana_Hanization-master]# systemctl restart kibana.service 
再次通过浏览器访问 http://kibana服务器IP:5601

通过kibana查看集群信息

点击系统监控,可以查看集群状态

通过kibana查看logstash收集的日志索引

系统管理------index Patterns
为了方便查看数据,没有加时间戳
最后点发现查看
也可以搜索关键字查看需要的信息
先启用查询功能
查看su命令的相关日志

通过kibana做可视化图形

选择对应索引,这里我新建了yum索引
对应中文为
启动logstash中的脚本以及elasticsearch的进程
es2:
powershell 复制代码
[root@es2 ~]# ls
accounts.json    Downloads                Music                           Templates
anaconda-ks.cfg  elasticsearch-6.5.2.rpm  node-v10.24.1-linux-x64.tar.xz  Videos
Desktop          elasticsearch-head       Pictures
Documents        initial-setup-ks.cfg     Public
[root@es2 ~]# cd elasticsearch-head/
[root@es2 elasticsearch-head]# ls
crx                                 index.html         plugin-descriptor.properties
Dockerfile                          LICENCE            proxy
Dockerfile-alpine                   node_modules       README.textile
elasticsearch-head.sublime-project  nohup.out          _site
Gruntfile.js                        package.json       src
grunt_fileSets.js                   package-lock.json  test
[root@es2 elasticsearch-head]# nohup npm run start &
[1] 10641
[root@es2 elasticsearch-head]# nohup: ignoring input and appending output to 'nohup.out'
logstash:
powershell 复制代码
[root@logstash ~]# jobs -l
[root@logstash ~]# cat /etc/logstash/conf.d/test.conf 
input {
	file {
		path => "/var/log/messages"
		start_position => "beginning"
		type => "messages"
	}

	file {
		path => "/var/log/yum.log"
		start_position => "beginning"
		type => "yum"
	}
}

filter {

}

output {
	if [type] == "messages" {
	elasticsearch {
		hosts => ["192.168.100.10:9200","192.168.100.20:9200"]
		index => "messages-%{+YYYY-MM-dd}"
		}
	}

	if [type] == "yum" {
        elasticsearch {
                hosts => ["192.168.100.10:9200","192.168.100.20:9200"]
                index => "yum-%{+YYYY-MM-dd}"
                }
        }

}
[root@logstash ~]# cd /usr/share/logstash/bin
[root@logstash bin]# ./logstash --path.settings /etc/logstash/ -r -f /etc/logstash/conf.d/test.conf &
[1] 10346
[root@logstash bin]# jobs -l
[1]+ 10346 Running                 ./logstash --path.settings /etc/logstash/ -r -f /etc/logstash/conf.d/test.conf &
......
......
[2025-10-24T11:18:40,717][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
下载一个服务
powershell 复制代码
[root@logstash ~]# mount /dev/cdrom /mnt
mount: /dev/sr0 is write-protected, mounting read-only
[root@logstash ~]# yum -y install vsftpd
[root@logstash ~]# cat /var/log/yum.log
Oct 23 10:38:29 Installed: apr-1.4.8-3.el7_4.1.x86_64
Oct 23 10:38:29 Installed: apr-util-1.5.2-6.el7.x86_64
Oct 23 10:38:29 Installed: httpd-tools-2.4.6-88.el7.centos.x86_64
Oct 23 10:38:29 Installed: mailcap-2.1.41-2.el7.noarch
Oct 23 10:38:30 Installed: httpd-2.4.6-88.el7.centos.x86_64
Oct 24 11:33:24 Installed: vsftpd-3.0.2-25.el7.x86_64
查看
相关推荐
i***48611 小时前
Nginx中$http_host、$host、$proxy_host的区别
运维·nginx·http
小园子的小菜1 小时前
深度剖析Elasticsearch数据写入与读取:从分片同步到核心组件协同
大数据·elasticsearch·搜索引擎
Fɪʀᴇᴡᴏʀᴋs2 小时前
Oceanbase数据库—基于社区版本的数据库集群管理
运维·数据库·oceanbase
HalvmånEver2 小时前
Linux:基础开发工具(五)
linux·运维·服务器
qq_278984132 小时前
ubuntu vlan网络设置
linux·服务器·网络
q***58192 小时前
基础篇:Linux安装redis教程(详细)
linux·运维·redis
小二·2 小时前
Linux 高频面试题(50道 + 详细答案)
linux·运维·服务器
z***39623 小时前
Nginx中如何配置WebSocket代理?
运维·websocket·nginx
忆林5203 小时前
请求服务任何资源(静态/动态)都返回主页数据?多nginx针对单域名的多服务配置
运维·nginx
FLPGYH3 小时前
BMC 深度解析:服务器带外管理的核心技术架构与实践
linux·服务器·c++·驱动开发