4

I'm using logstash and its configuration file (documented here) looks like this:

input {
  file {
    path => "/some/path/to/file"
    option => 1
  }
}
filter {
  if [var] == "string" {
    action {
      array_option => [ "val1", "val2", "val3" ]
      object_option => {
        str_option => "string"
      }
    }
  }
}
# this is a comment
output {
  stdout
}

I'm looking for a helpful emacs mode that works well with files like this. The conf-mode does good highlighting, but I can't get it to indent properly. Any suggestions?

  • This looks very similar to Puppet configuration files, or maybe Ruby in general. What if you try any of those modes (it probably won't cover it 100%, but should be very close). – wvxvw Sep 13 '15 at 9:36
  • You're right. It is actually ruby. ruby-mode works perfectly. Thnx. – gogators Sep 13 '15 at 18:34
1

Although ruby-mode works pretty well, there were some problems. After trying several other modes, I found this json-mode to work perfectly.

1

Technically it's a custom grammar: https://stackoverflow.com/questions/21442715/what-is-the-format-of-logstash-config-file

This is supposed to be just for logstash configs: https://github.com/Wilfred/logstash-conf.el

I came across this answer looking for something for Atom. Nothing exists as far as I can tell, but similarly the Ruby and JSON modes in Atom do an OK job of highlighting and indenting (auto-indent also works).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.