windows下安装filebeat

简介:windows下安装filebeat,并且初次使用

1.PowerShell安装 Filebeat

此处只介绍 Windows 下面的安装,至于其他系统, 请参考: 官方文档

下载并解压后,有两种方式运行,一种是注册为 Windows 服务,另一种是直接通过命令行运行;下面分别介绍两种方式。

1.1 注册为 Windows 服务

前提:系统必须有 PowerShell,因为官方安装包中提供的脚本只能在 PowerShell 中运行,若是 win10 系统,可忽略,因为它已经自带了 PowerShell, 否则请下载 PowerShell 并安装。

  1. 下载安装包 点我下载.
  2. 解压到以下目录: C:\Program Files 。
  3. 重命名 filebeat-<version>-windows 为 Filebeat 。
  4. 以 管理员 身份运行 PowerShell 。
  5. 在 PowerShell 中运行以下命令:
  6. cd 'C:\Program Files\Filebeat'
  7. C:\Program Files\Filebeat> .\install-service-filebeat.ps1
注:
如果此处提示你没有权限,请运行以下的命令注册 Filebeat 服务 :
PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-filebeat.ps1
  • 1
  • 2
  • 3

到这,已经将 Filebeat 成功注册为系统服务,当下一次开机时它会自动启动,当然你也可以手动通过服务控制面板启动它。

这里我的报错: 未解决,使用下面直接运行

Windows PowerShell
版权所有 (C) 2015 Microsoft Corporation。保留所有权利。

PS C:\Users\lcc> cd J:\elasticsearch\filebeat
PS J:\elasticsearch\filebeat> .\install-service-filebeat.ps1
.\install-service-filebeat.ps1 : 无法加载文件 J:\elasticsearch\filebeat\install-service-filebeat.ps1,因为在此系统上禁
止运行脚本。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ .\install-service-filebeat.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS J:\elasticsearch\filebeat> PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service-filebeat.ps1
PowerShell.exe : 无法将“PowerShell.exe”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括
路径,请确保路径正确,然后再试一次。
所在位置 行:1 字符: 1
+ PowerShell.exe -ExecutionPolicy UnRestricted -File .\install-service- ...
+ ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (PowerShell.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

2. 通过命令行运行 Filebeat

解压安装包,不需要安装,就可以用了 
通过命令行运行 Filebeat 非常简单,只需将 Filebeat 文件解压到某个目录后,通过以下命令运行:

filebeat -e -c filebeat.yml
  • 1

运行结果如下:


C:\Users\lcc>J:

J:\elasticsearch\filebeat>filebeat -e -c filebeat.yml
2018/03/06 13:52:21.929143 beat.go:436: INFO Home path: [J:\elasticsearch\filebeat] Config path: [J:\elasticsearch\filebeat] Data path: [J:\elasticsearch\filebeat\data] Logs path: [J:\elasticsearch\filebeat\logs]
2018/03/06 13:52:21.998692 beat.go:443: INFO Beat UUID: 72405e7b-7ce4-4b88-9a68-5855a00f8d7b
2018/03/06 13:52:22.011701 beat.go:203: INFO Setup Beat: filebeat; Version: 6.1.0
2018/03/06 13:52:21.983181 metrics.go:23: INFO Metrics logging every 30s
2018/03/06 13:52:22.042723 client.go:123: INFO Elasticsearch url: http://localhost:9200
2018/03/06 13:52:22.053731 module.go:76: INFO Beat name: DESKTOP-8H6R9VN
2018/03/06 13:52:22.080750 beat.go:276: INFO filebeat start running.
2018/03/06 13:52:22.098763 registrar.go:71: INFO No registry file found under: J:\elasticsearch\filebeat\data\registry. Creating a new registry file.
2018/03/06 13:52:22.189828 registrar.go:108: INFO Loading registrar data from J:\elasticsearch\filebeat\data\registry
2018/03/06 13:52:22.197334 registrar.go:119: INFO States Loaded from registrar: 0
2018/03/06 13:52:22.236360 crawler.go:48: INFO Loading Prospectors: 1
2018/03/06 13:52:22.247369 crawler.go:82: INFO Loading and starting Prospectors completed. Enabled prospectors: 0
2018/03/06 13:52:22.251872 reload.go:127: INFO Config reloader started
2018/03/06 13:52:22.245867 registrar.go:150: INFO Starting Registrar
2018/03/06 13:52:22.267383 reload.go:219: INFO Loading of config files completed.
2018/03/06 13:52:52.050789 metrics.go:39: INFO Non-zero metrics in the last 30s: beat.info.uptime.ms=31150 beat.memstats.gc_next=4194304 beat.memstats.memory_alloc=1362136 beat.memstats.memory_total=2989128 filebeat.harvester.open_files=0 filebeat.harvester.running=0 libbeat.config.module.running=0 libbeat.config.reloads=1 libbeat.output.type=elasticsearch libbeat.pipeline.clients=0 libbeat.pipeline.events.active=0 registrar.states.current=0 registrar.writes=1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20

https://baijiahao.baidu.com/s?id=1579517215515045102&wfr=spider&for=pc 
https://docs.microsoft.com/zh-cn/powershell/scripting/setup/setup-reference?view=powershell-6 
http://blog.csdn.net/github_39939645/article/details/78896737

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值