安装及配置
下载 Kibana 安装包
Download Elastic Stack Kibana 7.6.1
上传解压
tar -xzf kibana-7.6.1-linux-x86_64.tar.gz
配置
cd /opt/server/kibana-7.6.1-linux-x86_64/config
vim kibana.yml
server.host: "node1"
# The Kibana server's name. This is used for display purposes.
server.name: "kibana-server"
# The URLs of the Elasticsearch instances to use for all your queries.
elasticsearch.hosts: ["http://node1:9200","http://node2:9200","http://node3:9200"]
启动及测试
启动
cd /opt/server/kibana-7.6.1-linux-x86_64
# root 用户启动
./bin/kibana --allow-root
# 非 root 用户启动,前提是安装及配置都使用该非 root 用户
./bin/kibana
访问
http://node1:5601/status
常见的报错信息
非 root 用户启动
错误详情
Kibana should not be run as root. Use --allow-root to continue.
处理方式
./bin/kibana --allow-root
添加Elasticsearch数据源
说明
通过定义索引模式(Index Patterns)来对应匹配 Elasticsearch 索引,匹配出来的索引就是我们想要处理、分析的 Elasticsearch 索引
定义一个索引模式
字段功能详情
索引创建成功后,会显示出匹配索引的所有字段,描述了哪些可以用于搜索、哪些可以用来进行聚合计算等
探索数据(Discovery)
说明
通过Kibana中的Discovery组件,我们可以快速地进行数据的检索、查询
查看索引中的文档数据
基于时间过滤查询
根据时间范围查询
查询指定的某一天的数据
在直方图中拖动查看
Kibana查询语言(KQL)
说明
Kibana 上线了新的查询语言,这种语言简洁、易用,有利于快速查询
# 格式
# 如果值是字符串,可以用双引号括起来
字段:值
# 示例:查询 status 字段的值为 404 的数据
status : 404
# 示例
# 查询所有字段中包含 xxx 的数据
*abc*
过滤字段
说明
Kibana 的 Discovery 组件提供各种各样的筛选器,这样可以筛选出来我们关注的数据上