Installing Logstash as a service on Windows Server 2012

Prerequisites:

  1. Before installing Logstash on Windows Server 2012, install the latest Oracle JDK and set the JAVA_HOME environment variable.
  2. Install NSSM

To install Logstash as a service on Windows Server 2012

  1. Download Logstash
  2. Click on Start and type Explorer and click File Explorer
  3. Right-click on Local Disk (C:) and select New > Folder and type Logstash
  4. Locate and double-click the Logstash downloaded file
  5. Double-click on the Logstash-<version> folder and select all the items
  6. Right-click on the items and click Copy
  7. Click on Local Disk (C:) and right-click on the Logstash folder and click Paste
  8. Click Start and type in notepad and click Notepad
  9. Type in the following:
  10. input { stdin { } }
    output {
      elasticsearch { hosts => ["localhost:9200"] }
      stdout { codec => rubydebug }
    }
  11. Click File > Save
  12. Browse to c:\Logstash\bin
  13. In File name type in config.json and click Save
  14. Click Start and type in cmd and right-click Command Prompt
  15. Click Run as administrator
  16. Type in cd\nssm and press Enter
  17. Type in nssm install logstash c:\logstash\bin\logstash.bat and press Enter
  18. Type in nssm set logstash AppParameters -f c:\Logstash\bin\config.json and press Enter
  19. Type in nssm set logstash AppDirectory C:\Logstash\bin and press Enter

 

Advertisements