kibana与filebeat环境搭建,及kibana基本使用
一、部署kibana软件
1.下载kibana
[root@elk01 ~]# wget https://artifacts.elastic.co/downloads/kibana/kibana-7.17.23-amd64.deb
2.安装kibana
[root@elk01 ~]# dpkg -i kibana-7.17.23-amd64.deb
3.修改kibana的配置文件
[root@elk01 ~]# vim /etc/kibana/kibana.yml
[root@elk01 ~]#
[root@elk01 ~]# yy /etc/kibana/kibana.yml
server.port: 5601
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://10.0.0.91:9200","http://10.0.0.92:9200","http://10.0.0.93:9200"]
i18n.locale: "zh-CN"
[root@elk91 ~]#
4.启动kibana
[root@elk01 ~]# systemctl enable --now kibana.service
[root@elk01 ~]# ss -ntl | grep 5601
LISTEN 0 511 0.0.0.0:5601 0.0.0.0:*
[root@elk91 ~]#
5.访问kibana的WebUI
http://10.0.0.91:5601/
二、部署filebeat软件
1. 下载filebeat软件包
wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.17.23-amd64.deb
svip:
[root@elk03 ~]# wget http://192.168.13.253/Resources/ElasticStack/softwares/filebeat-7.17.23-amd64.deb
2. 安装filebeat
[root@elk03 ~]# dpkg -i filebeat-7.17.23-amd64.deb
3. 编写配置文件
[root@elk03 ~]# cd /etc/filebeat/
[root@elk03 filebeat]#
[root@elk03 filebeat]# cat 01-stdin-to-console.yaml
# 指定filebeat的输入类型
filebeat.inputs:
# 指定类型为标准输入
- type: stdin
# 指定输出类型是console表示控制台
output.console:
# 以漂亮的格式输出,而非扁平化输出。
pretty: true
[root@elk03 filebeat]#
[root@elk03 filebeat]# filebeat -e -c 01-stdin-to-console.yaml
...
2024-10-28T10:57:12.535+0800 INFO [crawler] beater/crawler.go:106 Loading and starting Inputs completed. Enabled inputs: 1
111111111111111111111111
{
"@timestamp": "2024-10-28T02:57:42.149Z",
"@metadata": {
"beat": "filebeat",
"type": "_doc",
"version": "7.17.23"
},
"input": {
"type": "stdin"
},
"ecs": {
"version": "1.12.0"
},
"host": {
"name": "elk03"
},
"agent": {
"ephemeral_id": "8a4148ba-5317-42eb-b8d0-2ad721273645",
"id": "2d8b2474-e977-4dda-a98f-4782dafbc44f",
"name": "elk93",
"type": "filebeat",
"version": "7.17.23",
"hostname": "elk93"
},
"log": {
"offset": 0,
"file": {
"path": ""
}
},
"message": "111111111111111111111111"
}
4. filebeat配置nginx采集日志
root@elk03:/etc/filebeat# cat 04-nginx-modules-to-es.yml
filebeat.inputs:
- type: log
paths:
- /var/log/nginx/access.log*
output.elasticsearch:
hosts: ["http://10.0.0.91:9200","http://10.0.0.92:9200","http://10.0.0.93:9200"]
# 写入ES时指定索引的名称
index: "oldboyedu-linux94-nginx-elk03-%{+yyyy.MM.dd}"
# 禁用索引声明周期,若不禁用,则自定义的索引配置不生效
setup.ilm.enabled: false
# 定义索引的模板的名称
setup.template.name: "oldboyedu-linux94-nginx"
# 定义索引模板的匹配模式(作用就是用来匹配索引的名称)
setup.template.pattern: "oldboyedu-linux94-nginx*"
# 如果索引模板存在,是否覆盖原有的索引模板配置
setup.template.overwrite: false
# 定义索引模板的设置
setup.template.settings:
# 自定义索引的分片数量
index.number_of_shards: 3
# 自定义索引的副本数量
index.number_of_replicas: 0
共有 0 条评论