部署filebeat采集nginx

部署filebeat采集nginx 其余应用请参考

1.下载并安装 Filebeat

第一次使用 Filebeat?请参阅入门指南。https://www.elastic.co/guide/en/beats/filebeat/7.4/filebeat-getting-started.html



curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.4.2-x86_64.rpm
sudo rpm -vi filebeat-7.4.2-x86_64.rpm

2.编辑配置

修改/etc/filebeat/filebeat.yml设置连接信息:



output.elasticsearch:
  hosts: ["<es_url>"]
  username: "elastic"
  password: "<password>"
setup.kibana:
  host: "<kibana_url>"
哪里<password>是elastic用户的密码,<es_url>是Elasticsearch<kibana_url>的URL,是Kibana的URL。

本次部署并未使用x-pack安全认证,username&password 可直接注释。以下为示例

setup.kibana:
	host: "221.204.171.215:30934"
output.elasticsearch:
	hosts: ["221.204.171.215:32637"]

3.启用和配置 nginx 模块

sudo filebeat modules enable nginx

修改/etc/filebeat/modules.d/nginx.yml文件中的设置。  以下为示例

- 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:
    var.paths:  ["/usr/local/nginx/logs/error.log*"]

4.启动 Filebeat

该setup命令加载 Kibana 仪表板。如果已设置仪表板,请省略此命令。

sudo filebeat setup
sudo service filebeat start
sudo systemctl start filebeat

···

即查看filebeat状态是否正常,无误后,kibana找寻对应索引即可。
posted @   千里。  阅读(496)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示