一、下载filebeat

下载地址:filebeat官网下载地址

  • WINDOWS 64-BITsha

二、装置filebeat

1.将压缩包放到C盘目录下进行解压
2.批改配置文件filebeat.yml
- type: log  enabled: true  encoding: utf-8  paths:    - c:\programdata\elasticsearch\logs\*  fields:    logtype: test    group: test    server: test10  fields_under_root: true    exclude_lines: ['poll','running','Content-Length']

配置文件具体细节请参考:官网filebeat配置文件配置

3.后盾通过powershell启动filebeat服务

管理员启动powershell,切换到filebeat目录;运行install-service-filebeat.ps1,
装置filebeat为服务;启动命令: start-Service filebeat

4.常见谬误


如果遇到如上谬误(脚本执行策略的问题),解决形式如下:

  1. 以管理员身份运行PowerShell
  2. 执行:get-ExecutionPolicy.查看PowerShell脚本运行权限政策
  3. 执行:set-ExecutionPolicy RemoteSigned即可
  4. 装置完当前再批改回来 Set-ExecutionPolicy Restricted
5.也可通过以下命令测试filebeat运行
测试命令:.\filebeat.exe -c .\filebeat.yml --configtest运行命令:.\filebeat.exe -e -c .\filebeat.yml

参考附录

windows增加filebeat收集日志
Powershell-"无奈加载文件,因为在此零碎上禁止运行脚本"
windows环境应用filebeat模块收集日志