Last active
December 24, 2015 10:09
-
-
Save epu/6781909 to your computer and use it in GitHub Desktop.
logstash cmd file wrapper based around the cookbook.
had to forward slash --config file option (bug? --log works ok..)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: http://cookbook.logstash.net/recipes/windows-service/ | |
@setlocal | |
@set LOGSTASH_DIR=%~dp0 | |
:: it would be nice to symlink the jar into logstash.jar with mklink, so name never changes. -epu | |
@set LOGSTASH_JAR=%LOGSTASH_DIR%logstash-1.2.1-flatjar.jar | |
@set LOGSTASH_CONF=%LOGSTASH_DIR%%~n0.conf | |
:: I know, right? the logger log! | |
@set LOGSTASH_LOG=%LOGSTASH_DIR%%~n0.log | |
:: Why did we set this? Why forward slashing? | |
@set HOME=c:/logstash/sincedb | |
:: locally, this is an x64 java. | |
@set JAVA=%JAVA_HOME%\bin\java.exe | |
@set OPTIONS=-Xmx32M | |
@set OPTIONS=%OPTIONS% -jar "%LOGSTASH_JAR%" | |
@set OPTIONS=%OPTIONS% agent | |
:: --config doesn't accept windows backslashes in path. D: | |
:: but --log does? Yeah. Log does. Flipping them both anyways. | |
:: from set /? -- replace text in a variable with %PATH:str1=str2% | |
@set OPTIONS=%OPTIONS% --config "%LOGSTASH_CONF:\=/%" | |
@set OPTIONS=%OPTIONS% --log "%LOGSTASH_LOG:\=/%" | |
@pushd "%LOGSTASH_DIR%" | |
"%JAVA%" %OPTIONS% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had to install service as c:\windows\system32\cmd.exe /K c:\logstash\logstash.cmd