赞
踩
目录
数据收集:Filebeat 安装在服务器上,监视指定的日志文件或目录,捕获日志数据。
数据处理和存储:Filebeat 将捕获的数据发送到 Elasticsearch。Elasticsearch 负责数据的索引、存储和搜索。
数据分析和可视化:Kibana 连接到 Elasticsearch,用户通过 Kibana 可以分析和可视化数据,创建仪表板,以便轻松地提取数据的洞察和价值。
docker network create logging
- # 创建容器
- docker run -d \
- --name=elasticsearch \
- --net=logging \
- -v=elasticsearch-data:/usr/share/elasticsearch/data \
- -e "discovery.type=single-node" \
- -e "xpack.security.enabled=false" \
- -e "ES_JAVA_OPTS=-Xms512m -Xmx1g" \
- -p 9200:9200 \
- docker.elastic.co/elasticsearch/elasticsearch:8.10.2
-
- # 查看创建的容器
- docker ps
-
- # 测试访问
- curl http://127.0.0.1:9200/_cat/health

- # 创建容器
- docker run -d \
- --name=kibana \
- --net=logging \
- -e ELASTICSEARCH_HOSTS=http://elasticsearch:9200 \
- -e I18N_LOCALE=zh-CN \
- -p 5601:5601 \
- docker.elastic.co/kibana/kibana:8.10.2
-
- # 查看容器
- docker ps | grep kibana
-
- # 测试访问
- 浏览器访问 IP:5601
- docker run -d \
- --name=filebeat \
- -v /etc/filebeat/filebeat.yml:/usr/share/filebeat \
- -v /var/log/:/var/log/ \
- --user=root \
- --network=host \
- harbor.daboluo.com/elk/filebeat:8.10.2
- vim /etc/filebeat/filebeat.yml
- filebeat.inputs:
- - type: log
- enabled: true
- paths:
- - /var/log/nginx/access.log
- - /var/log/nginx/error.log
- fields:
- project: filebeat
- app: nginx
- - type: log
- enabled: true
- paths:
- - /var/log/messages
- fields:
- project: filebeat
- app: messages
-
- setup.template.name: "filebeat"
- setup.template.pattern: "filebeat-*"
-
- output.elasticsearch:
- hosts: ["http://10.88.62.182:9200"]
- index: "%{[fields.project]}-%{[fields.app]}-%{+yyyy.MM.dd}"

docker restart filebeat
- # rpm包下载地址:
- https://www.elastic.co/cn/downloads/past-releases
-
- # 安装
- rpm -ivh filebeat-8.10.2-x86_64.rpm
- vim /etc/filebeat/filebeat.yml
- filebeat.inputs:
- - type: log
- enabled: true
- paths:
- - /var/log/nginx/access.log
- - /var/log/nginx/error.log
- fields:
- project: ms
- app: nginx
- - type: log
- enabled: true
- paths:
- - /var/log/messages
- fields:
- project: cu
- app: messages
-
- setup.template.name: "filebeat"
- setup.template.pattern: "filebeat-*"
-
- output.elasticsearch:
- hosts: ["http://$elasticsearchIP:9200"]
- index: "%{[fields.project]}-%{[fields.app]}-%{+yyyy.MM.dd}"

systemctl start filebeat && systemctl enable filebeat
浏览器访问kibana容器物理机的 ip:端口
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。