When shipping Nginx Access logs to Logstash, I recommend formatting the log lines in JSON straight out of Nginx. This speeds up filtering in Logstash later. It does come with two caveats though; Nginx escapes many characters that may appear
Consul and Consul-Template are two powerful tools for updating server files and executing a command after the file has been updated. This makes it a great and lightweight tool for managing configuration files for applications that need to reload or restart after
This one-liner traverses a directory tree, reads the files and PUTs them into Consul Key/Value Store using the filename as the key and it’s contents as the value.
for i in $(find . -type f | sed 's/\.\///g'); do echo; echo $i; curl -H "Content-Type: application/json" -XPUT --data "@$i" "http://localhost:8500/v1/kv/$i"; done;
sel.datum(aryData) vs. sel.data(aryData).datum() gives aryData to all elements in the selection..data() gives one unique array value in aryData to each element in the selection (i.e. .update()). It also has .enter() and .exit() as methods. ExampleHere’s the data we’ll use with .data()
Now that we have some keys in Consul, we want to get that into a Nagios configuration file using Consul-Template. Consul-Template requires only two files which are used to create a third.hosts.hcl – template configuration hosts.ctmpl – template hosts.cfg – outputI’m
In my overview post I showed a key/value structure in Consul that could be used to store metadata on each Node.Now I’ll discusses how to put node metadata into the Consul key-store. For this example we have two web servers in the
This post is a brief introduction of how I setup a system to add, update and remove Nagios configurations as servers are created and destroyed. Future posts detailing each step will be coming soon. Until then you can go to hashicorp.com or nagios.org for