Run Logstash as a Windows Service with AlwaysUp

How to Install Logstash as a Windows Service with AlwaysUp

Automatically start Logstash immediately when your server boots and keep it running 24/7. Ensure that your important log files are always being processed.

Logstash is an open-source tool that ingests data from a variety of sources and transforms that data into a more "friendly" format.

To install Logstash as a Windows Service:

  1. If necessary, download, install and configure Logstash.

    • You can grab the Logstash zip file from the Elastic web site and expand its contents to a location of your choice. Note that we have placed the software in C:\Logstash and we'll use that folder throughout this tutorial.

    • Ensure that Logstash starts properly when you run the "logstash.bat" file with the full path to your configuration file. For example, if your config file is called "C:\Logstash\logstash.conf", then try running this from Logstash bin folder:

      logstash.bat -f C:\Logstash\logstash.conf

    • AlwaysUp will not be able to start Logstash as a Windows Service if that command fails!

  2. Download and install AlwaysUp, if necessary.

  3. Start AlwaysUp.

  4. Select Application > Add to open the Add Application window:

    Add Application

  5. On the General tab:

    • In the Application field, enter the full path to the logstash.bat file (in your bin directory). Since we have installed Logstash in C:\Logstash, ours batch file is here:

      C:\Logstash\bin\logstash.bat

    • In the Arguments field, enter -f followed by the full path to your Logstash configuration file. We'll enter:

      -f C:\Logstash\logstash.conf

    • In the Name field, enter the name that you will call the application in AlwaysUp. We've stuck with the default of Logstash but you can specify another value you like.

    Logstash Windows Service: General Tab

  6. On the Logon tab:

    • Enter the user name and password of the Windows account you are logged into when you start Logstash. Logstash should run in this account to find its Java settings (environment variables, etc).

    • If you wish to hide the DOS/command window that comes up when you run Logstash (recommended), check the When a user logs on, don't show the application's windows and tray icons (if any) box at the bottom. Hiding the command window will prevent the Interactive Services Detection alert from constantly coming up as Logstash runs in the background "Session 0".

    Logstash Windows Service: Logon Tab

  7. Click over to the Startup tab and check the Ensure that the Windows Networking components have started box. This informs AlwaysUp that Logstash needs the TCP/IP networking stack to operate.

    Logstash Windows Service: Startup Tab

  8. Move to the Extras tab. If you wish to capture the text normally displayed on the command window created by logstash.bat (recommended, as you will no longer see the console when it's running in the background as a service), check the Capture output to this log file box and specify the full path to a file. We have specified C:\Logstash\logstash-log.txt.

    Logstash Windows Service: Extras Tab

  9. Click the Save button. In a couple of seconds, an application called Logstash will show up in the AlwaysUp window. It is not yet running though, and the state will be "Stopped":

    Logstash Windows Service: Created

  10. To fire up Logstash, choose Application > Start "Logstash". The State column should transition to Running after a few seconds and the service should be available to all your applications.

    Click the green circle to see some details of the CMD process running Logstash:

    Logstash Windows Service: Running

    And you should see a few lines in the output file you configured on the "Extras" tab:

    Logstash Output File

    Check it over to make sure that Logstash isn't running into any problems...

  11. That's it! Next time your computer boots, your Logstash will start up automatically, before anyone logs on.

    We encourage you to edit Logstash in AlwaysUp and check out the many other settings that may be appropriate for your environment. For example, setup email notifications, add a TCP/IP "sanity check" to detect failures, or periodically restart Logstash to cure memory leaks.



Logstash not working properly as a Windows Service?

  • Review the output file you specified in step 8 for errors reported from Logstash.
  • Consult the AlwaysUp Troubleshooter - our online tool that can help you resolve the most common problems encountered when running an application as a windows service.
  • From AlwaysUp, select Application > Report Activity > Today... to bring up a HTML report detailing the interaction between AlwaysUp and Logstash. The AlwaysUp Event Log Messages page explains the messages that may turn up.
  • Browse the AlwaysUp FAQ for answers to commonly asked questions and troubleshooting tips.
  • Contact us and we will be happy to help!

Download & Try it Free!

Download AlwaysUp and Run as a Service Today! Version 15.1 New!

7.9 MB Installer
Our 12,000+ customers include...
Compatible with Windows 11 Compatible with Windows Server 2022 Compatible with Windows 10
Over 94,000 installations, and counting!
 
AlwaysUp is number 1! Run as a Service with AlwaysUp

Rock-solid for the past 19+ years!