“Filebeat nginx log”的版本间的差异
跳到导航
跳到搜索
(未显示同一用户的12个中间版本) | |||
第1行: | 第1行: | ||
[[category:ops]] | [[category:ops]] | ||
+ | =ins and config= | ||
+ | ==Download and install Filebeat== | ||
+ | <pre> | ||
+ | curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.12.0-amd64.deb | ||
+ | sudo dpkg -i filebeat-7.12.0-amd64.deb | ||
+ | </pre> | ||
+ | ==Edit the configuration == | ||
+ | <pre> | ||
+ | Modify /etc/filebeat/filebeat.yml to set the connection information: | ||
+ | output.elasticsearch: | ||
+ | hosts: ["<es_url>"] | ||
+ | username: "elastic" | ||
+ | password: "<password>" | ||
+ | setup.kibana: | ||
+ | host: "<kibana_url>" | ||
+ | |||
+ | #可能要加这个配置 | ||
+ | setup.ilm.overwrite: true | ||
+ | |||
+ | #type: log 那一节 | ||
+ | enabled: true | ||
+ | |||
+ | |||
+ | Where <password> is the password of the elastic user, <es_url> is the URL of Elasticsearch, and <kibana_url> is the URL of Kibana. | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | ==Enable and configure the nginx module == | ||
+ | |||
+ | <pre> | ||
+ | sudo filebeat modules enable nginx | ||
+ | |||
+ | Modify the settings in the /etc/filebeat/modules.d/nginx.yml file. | ||
+ | |||
+ | 可能要打开 填写这个目录 | ||
+ | |||
+ | vim /etc/filebeat/modules.d/nginx.yml | ||
+ | #var.paths: | ||
+ | var.paths: ["/var/log/nginx/error.log*"] | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | == Start Filebeat== | ||
+ | |||
+ | <pre> | ||
+ | The setup command loads the Kibana dashboards. If the dashboards are already set up, omit this command. | ||
+ | |||
+ | sudo filebeat setup | ||
+ | sudo service filebeat start | ||
+ | </pre> | ||
+ | |||
+ | == Module status== | ||
+ | <pre> | ||
+ | Module status 右边的 check data 按键 -- > Nginx logs dashboard | ||
+ | |||
+ | </pre> | ||
systemctl daemon-reload | systemctl daemon-reload | ||
=see also= | =see also= | ||
+ | [https://gist.github.com/Friz-zy/0103f68a522758f05163544c3e9017fd nginx_custom_log_with_elk_filebeat.conf] | ||
+ | |||
+ | [https://blog.csdn.net/qq_28834355/article/details/108261508 Filebeat配置module采集nginx日志] | ||
https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-nginx.html | https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-nginx.html | ||
+ | |||
+ | [https://blog.csdn.net/qq_28834355/article/details/108261508 Filebeat配置module采集nginx日志] | ||
+ | |||
+ | [https://ngx.hk/2017/12/18/%E6%8C%89%E6%9C%88%E5%88%86%E5%89%B2nginx%E8%AE%BF%E9%97%AE%E6%97%A5%E5%BF%97-filebeat%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E7%AE%80%E4%BB%8B.html 按月分割nginx访问日志-filebeat配置文件简介] | ||
+ | |||
+ | [https://www.cnblogs.com/kuku0223/p/8317965.html ELK--filebeat nginx模块] | ||
+ | |||
+ | [https://www.cnblogs.com/sky-cheng/p/11187534.html filebeat收集nginx的json格式日志 ] | ||
+ | |||
+ | [https://blog.51cto.com/michaelkang/2317953 filebeat 6.4.3 采集 nginx日志] | ||
+ | |||
+ | |||
+ | [http://www.javaobj.com/2020/05/nginx-logs/ 通过filebeat、logstash、rsyslog采集nginx日志的几种方式] |
2021年5月23日 (日) 14:25的最新版本
目录
ins and config
Download and install Filebeat
curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.12.0-amd64.deb sudo dpkg -i filebeat-7.12.0-amd64.deb
Edit the configuration
Modify /etc/filebeat/filebeat.yml to set the connection information: output.elasticsearch: hosts: ["<es_url>"] username: "elastic" password: "<password>" setup.kibana: host: "<kibana_url>" #可能要加这个配置 setup.ilm.overwrite: true #type: log 那一节 enabled: true Where <password> is the password of the elastic user, <es_url> is the URL of Elasticsearch, and <kibana_url> is the URL of Kibana.
Enable and configure the nginx module
sudo filebeat modules enable nginx Modify the settings in the /etc/filebeat/modules.d/nginx.yml file. 可能要打开 填写这个目录 vim /etc/filebeat/modules.d/nginx.yml #var.paths: var.paths: ["/var/log/nginx/error.log*"]
Start Filebeat
The setup command loads the Kibana dashboards. If the dashboards are already set up, omit this command. sudo filebeat setup sudo service filebeat start
Module status
Module status 右边的 check data 按键 -- > Nginx logs dashboard
systemctl daemon-reload
see also
nginx_custom_log_with_elk_filebeat.conf
https://www.elastic.co/guide/en/beats/filebeat/current/filebeat-module-nginx.html