在Windows中运行Filebeat(Running Filebeat in windows)

发布时间 2023-07-31 17:43:24作者: 技术颜良

 

我最近使用这些说明在Windows上设置了filebeat

https://www.elastic.co/downloads/beats/filebeat

但它迫使我保持​​cmd提示打开运行命令

filebeat.exe -c filebeat.yml

我想知道是否有办法将其作为后台进程运行?

谢谢。


I set up filebeat on windows recently using these instructions

https://www.elastic.co/downloads/beats/filebeat

but it forces me to keep a cmd prompt open running the command

filebeat.exe -c filebeat.yml

I am wondering if there is a way to run this as a background process?

Thanks.

更新时间:2022-08-27 07:08

最满意答案

尝试浏览Filebeat的完整入门指南 。 有Windows的说明。 基本上说明是:

  1. 随处提取下载文件。

  2. 将解压缩的目录移动到Program Files中。

    PS > mv filebeat-5.1.2-windows-x86_64 "C:\Program Files\Filebeat"
    
  3. 安装filebeat服务。

    PS > cd "C:\Program Files\Filebeat"
    PS C:\Program Files\Filebeat> powershell.exe -ExecutionPolicy UnRestricted -File .\install-service-filebeat.ps1
    
  4. 编辑filebeat.yml配置文件并测试您的配置。

    PS C:\Program Files\Filebeat> .\filebeat.exe -e -configtest
    
  5. (可选)在前台运行Filebeat以确保一切正常。 按Ctrl + C退出。

    PS C:\Program Files\Filebeat> .\filebeat.exe -c filebeat.yml -e -d "*"
    
  6. 启动服务。

    PS > Start-Service filebeat
    

如果您需要停止它,请使用Stop-Service filebeat 。 如果要更改配置,可能需要将其停止并启动它。


Try walking through the full Getting Started guide for Filebeat. There are instructions for Windows. Basically the instructions are:

  1. Extract the download file anywhere.

  2. Move the extracted directory into Program Files.

    PS > mv filebeat-5.1.2-windows-x86_64 "C:\Program Files\Filebeat"
    
  3. Install the filebeat service.

    PS > cd "C:\Program Files\Filebeat"
    PS C:\Program Files\Filebeat> powershell.exe -ExecutionPolicy UnRestricted -File .\install-service-filebeat.ps1
    
  4. Edit the filebeat.yml config file and test your config.

    PS C:\Program Files\Filebeat> .\filebeat.exe -e -configtest
    
  5. (Optional) Run Filebeat in the foreground to make sure everything is working correctly. Ctrl+C to exit.

    PS C:\Program Files\Filebeat> .\filebeat.exe -c filebeat.yml -e -d "*"
    
  6. Start the service.

    PS > Start-Service filebeat
    

And if you need to stop it, use Stop-Service filebeat. You might need to stop it and start it if you want to make changes to the config.