Skip to content

Instantly share code, notes, and snippets.

@Spredzy
Created September 19, 2013 17:46
Show Gist options
  • Save Spredzy/6627114 to your computer and use it in GitHub Desktop.
Save Spredzy/6627114 to your computer and use it in GitHub Desktop.
[Fixed] Logstash augeas lense
module Logstash =
autoload xfm
let eol = Util.eol
let indent = Util.indent
let string_t = /('|")[^ \t\n]*('|")/
let sep_obr = del /[ \t]*\{([ \t]*\n)*/ " {\n"
let sep_cbr = del /[ \t]*\}([ \t]*\n)*/ "}\n"
let sep_arrow = del /[ \t]*=>[ \t]*/ "=>"
let param = Build.key_value_line /[a-zA-Z0-9_]*/ sep_arrow (store string_t)
let plugin =
[indent . key /[a-zA-Z0-9_]+/ . sep_obr . param* . sep_cbr]
let section (name:string) =
[indent . key /[a-zA-Z0-9_]+/ . sep_obr . plugin* . sep_cbr]
let l_input = section "input"
let lns = l_input
let filter = incl "/etc/logstash/logstash.conf"
let xfm = transform lns filter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment