Skip to content

Instantly share code, notes, and snippets.

@tolland
Created March 13, 2012 20:35
Show Gist options
  • Save tolland/2031393 to your computer and use it in GitHub Desktop.
Save tolland/2031393 to your computer and use it in GitHub Desktop.
## put this in the path called genconfig;
#!/bin/bash
tmpfile=$(mktemp)
erb -T - $1 > $tmpfile
echo $tmpfile
# now you can make erb logstash templates like so;
input { file {
type => "syslog"
add_field => [ "offset", "<%= `echo -n $(date +%z)` -%>" ]
}}
# and invoke them like this;
$ grep "offset" $(genconfig test1.erb)
add_field => [ "offset", "+0000" ]
or...
$ java -jar logstash-monolith.jar agent -f $(genconfig myinputs.conf.erb)
Or you could just use chef!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment