kebochina 2019-11-30
可以将metricbeat数据在kibana中展示
[ ~]# cd /usr/local/metricbeat/
[ metricbeat]# grep -Ev "^$|[#;]" metricbeat.yml
metricbeat.config.modules: path: ${path.config}/modules.d/*.yml reload.enabled: false setup.template.settings: index.number_of_shards: 1 index.codec: best_compression setup.kibana: host: "192.168.132.131:5601" output.elasticsearch: hosts: ["192.168.132.131:9200","192.168.132.132:9200","192.168.132.133:9200"] processors: - add_host_metadata: ~ - add_cloud_metadata: ~
[ metricbeat]# ./metricbeat setup --dashboards
Loading dashboards (Kibana must be running and reachable) Loaded dashboards
[ metricbeat]# ./metricbeat -e
[ ~]# cd /usr/local/filebeat/
[ filebeat]# vim nginx-log.yml
filebeat.inputs: #- type: log # enabled: true # paths: # - /usr/local/nginx/logs/*.log # tags: ["nginx"] setup.template.settings: index.number_of_shards: 3 output.elasticsearch: hosts: ["192.168.132.131","192.168.132.132","192.168.132.133"] filebeat.config.modules: path: ${path.config}/modules.d/*.yml reload.enable: false setup.kibana: host: "192.168.132.131:5601" #output.console: # pretty: true # enable: true
[ filebeat]# ./filebeat -c nginx-log.yml setup
Index setup finished. Loading dashboards (Kibana must be running and reachable) Loaded dashboards Loaded machine learning job configurations Loaded Ingest pipelines
安装成功
[ filebeat]# ./filebeat -e -c nginx-log.yml
查看仪表盘
选择nginx
选择filebeat nginx
选择Nginx access and error logs,点击进入
{ "_index": "filebeat-7.4.2-2019.11.24-000001", "_type": "_doc", "_id": "N4tXum4BNbSd3xvSPU1B", "_version": 1, "_score": null, "_source": { "agent": { "hostname": "node4", "id": "2832793b-3bb6-4081-b05f-1955815440d0", "type": "filebeat", "ephemeral_id": "8d8616e1-8958-449b-9ee5-94a6fdde155b", "version": "7.4.2" }, "nginx": { "access": { "remote_ip_list": [ "192.168.132.1" ] } }, "log": { "file": { "path": "/usr/local/nginx/logs/access.log" }, "offset": 29010 }, "source": { "address": "192.168.132.1", "ip": "192.168.132.1" }, "fileset": { "name": "access" }, "url": { "original": "/" }, "input": { "type": "log" }, "@timestamp": "2019-11-30T03:25:08.000Z", "ecs": { "version": "1.1.0" }, "service": { "type": "nginx" }, "host": { "name": "node4" }, "http": { "request": { "referrer": "-", "method": "GET" }, "response": { "status_code": 304, "body": { "bytes": 0 } }, "version": "1.1" }, "event": { "timezone": "-05:00", "created": "2019-11-30T03:25:08.840Z", "module": "nginx", "dataset": "nginx.access" }, "user": { "name": "-" }, "user_agent": { "original": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36", "os": { "name": "Windows 10" }, "name": "Chrome", "device": { "name": "Other" }, "version": "78.0.3904" } }, "fields": { "suricata.eve.timestamp": [ "2019-11-30T03:25:08.000Z" ], "@timestamp": [ "2019-11-30T03:25:08.000Z" ], "event.created": [ "2019-11-30T03:25:08.840Z" ] }, "highlight": { "event.module": [ "@@/" ] }, "sort": [ 1575084308000 ] }
以上就是nginx的一个仪表盘,也可以自己定义仪表盘
进入格式化里
选择添加
选择制作柱状图
选择fielbeat
出现一下信息
选择完后,简单调整
添加其他信息,丰富我们的界面
把这个柱形图做一个保存
就可以根据取名搜到这个柱状图
也可以把这个柱状图放进我们的仪表盘里
点击仪表盘并创建新的仪表盘,点击add添加,搜索刚才取名的柱状图
则在界面出现我们创建的柱状图
在这里也可以添加多个图标,获取我们需要的信息
以上就是关于仪表盘的一个介绍