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

invalid yaml produces cryptic error #6509

Closed
jpcarey opened this issue Jan 9, 2017 · 4 comments
Closed

invalid yaml produces cryptic error #6509

jpcarey opened this issue Jan 9, 2017 · 4 comments

Comments

@jpcarey
Copy link

jpcarey commented Jan 9, 2017

Should improve the error thrown when an invalid yaml file is read from logstash.yml.

Current error:
ERROR: Failed to load settings file from "path.settings". Aborting... path.setting=/etc/logstash/, exception=Psych::SyntaxError, message=>(<unknown>): expected <block end>, but found BlockMappingStart while parsing a block mapping at line 155 column 2

  • Version: 5.1.1
  • Operating System: Cetos 7
  • Steps to Reproduce:
    • Install RPM
    • In /etc/logstash/logstash.yml, uncomment line 155, leaving the space at the beginning of the line.
    • Start logstash, and you will get the error pasted above.
@jsvd
Copy link
Member

jsvd commented Jan 9, 2017

We're limited to what the ruby's yaml parser gives us:

jruby-1.7.25 :017 > YAML.parse("teste:\n    teste.tet:\n  hey: - 1\n")
Psych::SyntaxError: (<unknown>): expected <block end>, but found BlockMappingStart while parsing a block mapping at line 3 column 3

The only option is to create a user friendly component that parses these messages, but it seems like a big time investment ..

@jpcarey
Copy link
Author

jpcarey commented Jan 9, 2017

I think if the error was more descriptive - that YAML.parse failed, and which file - that would be more than sufficient (along with the raw exception, which does contain the line number and character).

Maybe something like:
ERROR: Failed to parse YAML file: {{path.to.file}}. Aborting... path.setting=/etc/logstash/, exception=Psych::SyntaxError, message=>(<unknown>): expected <block end>, but found BlockMappingStart while parsing a block mapping at line 155 column 2

@jsvd
Copy link
Member

jsvd commented Jan 9, 2017

@jpcarey makes sense, thank you for the suggestion

@suyograo
Copy link
Contributor

Fixed in #6546

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.

3 participants