Kibana 部署

Kibana 是一个图形页面系统,用于对 Elasticsearch 数据可视化。

二进制方式部署:

tar -zxvf kibana-7.9.3-linux-x86_64.tar.gz 
mv kibana-7.9.3-linux-x86_64 /opt/elk/kibana

修改配置文件

vim /opt/elk/kibana/config/kibana.yml

server.port: 5601        
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://192.168.0.11:9200"]
i18n.locale: "zh-CN"

配置系统服务管理:

vim /usr/lib/systemd/system/kibana.service

[Unit]
Description=kibana
[Service]
ExecStart=/opt/elk/kibana/bin/kibana --allow-root
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
[Install]
WantedBy=multi-user.target

加载配置

systemctl daemon-reload
systemctl start kibana
systemctl enable kibana

索引模式

索引模式:将ES索引关联到Kibana,然后就可以再Discover菜单查看

数据搜索

基本查询:

• 查询URL(精确查询使用双引号)

request:“/index.html”

• 查询状态码200

response: 200

• 在消息字段中含有error

message: error

逻辑组合查询:

• 查询状态码200或者301

response: 200 or response: 301

• 查询状态码200并且URL是"/index.html“

response: 200 and request: "/index.html“

复合查询:

• 查询状态码200并且URL是/index.html或者/login.html

response:200 and (request: “/index.html” or request: “/login.html”)

• 查询状态码200或者301

response:(200 or 301)

结果取反查询:

• 匹配状态码不是200:

not response: 200

范围查询:支持>,>=,<,和<=

• 查询持续时间大于1

duration: <=1

通配符:

• 查询以win开头

machine.os: win

Kibana可视化和仪表盘

Kibana可视化(Visualize):基于ES查询,通过一系列聚合来提取 和处理数据,将结果进行图表展示。 另外,在创建图表需选择一个索引模式。

比较常用图表:

• 指标

• 折线图

• 饼图

• 数据表

Kibana 可视化和仪表盘

Kibana仪表盘:显示可视化和搜索的集合,统一展示。 可以随意排列,调整大小和编辑仪表盘内容等,非常灵活。

• 指标

• 折线图

• 饼图

• 数据表

制作成仪表盘