11

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.

ScipioAfricanus
  • 1,331
  • 6
  • 18
  • 39

1 Answers1

35

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 test config
    
  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.

Chintan Pathak
  • 302
  • 2
  • 5
  • 20
A J
  • 2,508
  • 21
  • 26
  • Hey, thanks a lot for the help. I tried to use the Start-Service but powershell says cannot find any service with service name filebeat – ScipioAfricanus Jan 20 '17 at 14:57
  • Did the `.\install-service-filebeat.ps1` script complete successfully? That's what adds the service. – A J Jan 20 '17 at 17:11
  • I did all of these steps succesfully. I needed to stopped and never cuold start it again. Someone can help me with that!! please!! – Daniel Silva Oct 02 '21 at 23:27