filebeat nginx 日志处理配置

31次阅读
没有评论

共计 1252 个字符,预计需要花费 4 分钟才能阅读完成。

1、7.4.0 启用模块

  ./filebeat modules list
  ./filebeat modules  enable nginx
  ./filebeat modules list

2、修改 modules.d/nginx.yml,主要添加日志对应地址

[elasticsearch@es1 filebeat-7.4.0-linux-x86_64]$ cat modules.d/nginx.yml 
# Module: nginx
# Docs: https://www.elastic.co/guide/en/beats/filebeat/7.4/filebeat-module-nginx.html
- module: nginx
  # Access logs
  access:
    enabled: true
    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths: ["/usr/local/nginx/logs/access.log*"]
  # Error logs
  error:
    enabled: true
    # Set custom paths for the log files. If left empty,
    # Filebeat will choose the paths depending on your OS.
    var.paths: ["/usr/local/nginx/logs/error.log"]

3、配置 filebeat 配置文件

[elasticsearch@es1 filebeat-7.4.0-linux-x86_64]$ cat nginx-m.yml 
filebeat.inputs:
#- type: log
#  enabled: true
#  paths:
#     - /usr/local/nginx/logs/*.log
#  tags: ["nginx"]
setup.template.settings:
  index.number_of_shards: 2
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["192.168.56.101:9200"]
filebeat.config.modules:
  path: ${path.config}/modules.d/*.yml
  reload.enabled: false
[elasticsearch@es1 filebeat-7.4.0-linux-x86_64]$

4、启动

 ./filebeat -e -c nginx-m.yml

5、访问并观察数据

filebeat nginx 日志处理配置

filebeat nginx 日志处理配置

filebeat  nginx 日志处理配置

向 AI 问一下细节

丸趣 TV 网 – 提供最优质的资源集合!

正文完
 
丸趣
版权声明:本站原创文章,由 丸趣 2024-02-03发表,共计1252字。
转载说明:除特殊说明外本站除技术相关以外文章皆由网络搜集发布,转载请注明出处。
评论(没有评论)