Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows: logstash.bat doesn't work if the directory contains spaces #6426

Closed
cawoodm opened this issue Dec 16, 2016 · 23 comments · Fixed by #12585
Closed

Windows: logstash.bat doesn't work if the directory contains spaces #6426

cawoodm opened this issue Dec 16, 2016 · 23 comments · Fixed by #12585
Assignees

Comments

@cawoodm
Copy link

cawoodm commented Dec 16, 2016

Just installed LogStash (after much trouble in getting JRuby to work in Win7...). However running bin\logstash.bat results in:

Unable to find JRuby.

The reason is complex but TL DR: Maybe you could just use %JRUBY_HOME% which is set when JRuby is installed.

The long version...

It seems setup is expecting a "vendor" version of JRuby inside LogStash:

set JRUBY_BIN="%LS_HOME%\vendor\jruby\bin\jruby"
if exist "%JRUBY_BIN%" (
  set VENDORED_JRUBY=1
goto finally
) else (
goto missing_jruby
)

However no such file is found. The closest thing we have is C:\Prg\monitoring\logstash\vendor\bundle\jruby\1.9\bin but there is no jruby file in there. Indeed, under Windows there should presumably be a jruby.exe in there.

@jsvd
Copy link
Member

jsvd commented Dec 16, 2016

are you trying to use logstash from a packaged release (.zip) or git repo for development?

@cawoodm
Copy link
Author

cawoodm commented Dec 16, 2016

Packaged.
I tried to point JRUBY_BIN at my JRuby 9.0 but apparently it's the wrong version. The bundled "vendor " version seems to be 1.9 but I could not find that anywhere for download???

@jsvd
Copy link
Member

jsvd commented Dec 16, 2016

@cawoodm you don't have to download jruby at all, logstash already comes packaged with it.

you only need to have JAVA_HOME defined, and the run bin\logstash.bat -h (or bin\logstash)

@jsvd
Copy link
Member

jsvd commented Dec 20, 2016

@cawoodm are you still seeing problems? if not feel free to close the issue

@cawoodm
Copy link
Author

cawoodm commented Dec 20, 2016

I'll give it a whirl tomorrow again but as I originally posted - running logstash resulted in "Unable to find JRuby." before I had done anything (JAVA_HOME was set, without trailing slash to JDK 1.8). IMO the batch was looking for a unix-like executable "jruby" (without extension),

@cawoodm
Copy link
Author

cawoodm commented Dec 21, 2016

I deleted and re-installed 5.1.1 and now it works. It could well be that I extracted logstash-5.1.1.zip using Windows' own unzip function (which has some issues) and ended up with an incomplete install.

@cawoodm cawoodm closed this as completed Dec 21, 2016
@visualskyrim
Copy link

So, I ran into the same issue last night. And I tried this morning again, it worked.
Before I ran logstash.bat, I executed setup.bat first for this time.
I don't it is the reboot or the setup.bat that made it work, but it's worth a try.

Hope it helps :)

@elvarb
Copy link

elvarb commented Jul 31, 2017

Ran into this just now, only with logstash-plugin and setup.bat first worked

@saigal06
Copy link

plz tell me the solution i m going through the same problem ...

@keyur9
Copy link

keyur9 commented Sep 30, 2017

Hey @saigal06, could you share where are you placing your config file? I'd be able to help you as I was also facing the same issue and figured it out.

@requiembkp
Copy link

@saigal06

Modify setup.bat

if not exist "%JRUBY_BIN%" ( --> if not exist %JRUBY_BIN% (

@pirelaurent
Copy link

i had same pb after installation.
As an old dos user, i saw that my logstash was unzip under a folder with a space in the name like : D:\myProgram Files\logstash-5.6.3> and it doesn't find jruby this way.
I move the directory upper into D:\logstash-5.6.3> (no spaces in full name) and i can run it from D:\logstash-5.6.3\bin>logstash.bat without pb.
( More : to run it from D:\logstash-5.6.3> must add quotes "bin/logstash.bat" )
HTH

@HarveyEV
Copy link

Yeah 5.6.3 zip installer has issues with dir structure for jruby which breaks the batch files. Rolling back to 5.6.2 worked for me.

@nemonster nemonster reopened this Oct 26, 2017
@nemonster
Copy link

Just an update - this is still broken. Removing the quotes from the JRUBY_BIN check does get past that error. However it will still fail when attempting to use the working directory with the spaces.

@r2o3k
Copy link

r2o3k commented Oct 30, 2017

That did the trick for me @pirelaurent, thanks!!! I also had to set JRUBY_HOME before doing anything as well.

@jordansissel
Copy link
Contributor

jordansissel commented Oct 30, 2017 via email

@aungkyawpike
Copy link

aungkyawpike commented Nov 1, 2017

@pirelaurent's the trick is working, Thanks a lot.
just remove the space in directory names, eg. my previous dir was C:\Elastic Stack\logstash-5.6.3
I removed the space and changed to C:\ElasticStack\logstash-5.6.3, it is working finally.

@elvarb
Copy link

elvarb commented Nov 16, 2017

Solution found!

When calling the logstash.bat file full path of the bat file must be used and in short format.

For example in my case I have logstash stored in C:\Program Files\Logstash, then there are subfolders for each Logstash version. So in the root folder I have logstash.bat that contains this.

"%~dps0logstash-5.6.4\bin\logstash.bat" -f %~dps0logstash-config\config\config.conf -r

When I run logstash.bat from the C:\Program Files\Logstash folder it will convert the current path location to a short name version.

C:\Program Files\Logstash\logstash-5.6.4\bin\logstash.bat becomes C:\Progra~1\Logstash\logstash-5.6.4\bin\logstash.bat

Found the solution at this link http://www.robvanderwoude.com/shorts.php

@jordansissel jordansissel changed the title Unable to find JRuby Windows: logstash.bat doesn't work if the directory contains spaces Nov 16, 2017
@jordansissel
Copy link
Contributor

I have updated the issue's description to hopefully accurately represent the bug.

@Kvinothine
Copy link

Have unzipped the logstash version 6.1.1 but when i run the logstash.bat file i m getting the following error
The system cannot find the path specified.
"could not find jruby in C:\Program Files\logstash-6.1.1\vendor\jruby"

Saw all the previous discussion and worked on those solutions since my problem is not solved but i checked the vendor directory jruby file was there.

Should i modify the setup.batch file

set JRUBY_BIN="%LS_HOME%\vendor\jruby\bin\jruby"
if not exist "%JRUBY_BIN%" (
echo "could not find jruby in %LS_HOME%\vendor\jruby" 1>&2
exit /b 1
)

instead of '%LS_HOME%' should i give C:\Program Files\logstash-6.1.1 tried that also but not working.

@schivei
Copy link

schivei commented Oct 19, 2018

I have the same problem with logstash 6.3.0 on windows.

the path of jruby bin is: vendor\bundle\jruby\2.3.0\bin

but, jruby executor is not located on the bin or other directory

@GsonLi
Copy link

GsonLi commented Jun 27, 2020

i had same pb after installation.
As an old dos user, i saw that my logstash was unzip under a folder with a space in the name like : D:\myProgram Files\logstash-5.6.3> and it doesn't find jruby this way.
I move the directory upper into D:\logstash-5.6.3> (no spaces in full name) and i can run it from D:\logstash-5.6.3\bin>logstash.bat without pb.
( More : to run it from D:\logstash-5.6.3> must add quotes "bin/logstash.bat" )
HTH

Thanks a lot!!!

@ghost
Copy link

ghost commented Oct 19, 2022

I deleted and re-installed 5.1.1 and now it works. It could well be that I extracted logstash-5.1.1.zip using Windows' own unzip function (which has some issues) and ended up with an incomplete install.

Faced the same issue. The issue was also improper extraction from Windows Explorer "Extract here" option. Using 7zip to extract did create the folders "\vendor\jruby\bin\jruby" and resolve the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.