Skip to content

Instantly share code, notes, and snippets.

View cgswong's full-sized avatar

Stuart Wong cgswong

View GitHub Profile
@cgswong
cgswong / logstash-test.conf
Last active August 29, 2015 14:18
Logstash Test config
# Where to get input
input {
# Get input from syslog
tcp {
port => 5514
type => "syslog"
}
udp {
port => 5514
type => "syslog"
@cgswong
cgswong / logstash-logspout.conf
Last active August 29, 2015 14:17
Basic logstash configuration for logspout
input {
tcp {
port => 5000
type => "dockerlog"
}
udp {
port => 5000
type => "dockerlog"
}
}
@cgswong
cgswong / consul-registrator-query.md
Created March 13, 2015 02:27
consul/registrator querying

Query Consul directly to see if Registrator registered the services in Consul: curl http://<Consul server IP address>:8500/v1/catalog/services | python -m json.tool

Provide JSON-formatted output that lists all the instances of a service across a consul/registrator cluster, the IP addresses and nodes associated with the service, and any metadata (which probably won’t exist).

curl http://:8500/v1/catalog/service/nginx-80 | python -m json.tool

@cgswong
cgswong / logstash-syslog.conf
Created March 6, 2015 19:35
logstash syslog configuration
input {
tcp {
port => 5000
type => syslog
}
udp {
port => 5000
type => syslog
}
}
@cgswong
cgswong / log-forwarder.service
Last active August 29, 2015 14:16
Log forwarder systemd unit for any OS with journal logs (CoreOS)
[Unit]
Description=Journal redirect to remote
[Service]
Restart=on-failure
StartLimitInterval=60s
StartLimitBurst=3
TimeoutStartSec=0
ExecStart=/bin/sh -c '/usr/bin/journalctl -f -o short | /usr/bin/ncat [hostname/IP] [port]'
PIDFile=/var/run/journalncat.pid
@cgswong
cgswong / elasticsearch.yml.tmpl
Created February 16, 2015 22:40
confd example for Elasticsearch that does conditional templating
discovery.zen.ping.unicast.hosts: [{{ range $index, $server := getvs "/services/logging/es/host/*" }}{{if $index}}, {{end}}"{{$server.Value}}"{{ end }}]
@cgswong
cgswong / JSON_bash_parse.sh
Last active August 29, 2015 14:15
JSON bash parser
curl -sL http://172.17.8.101:8500/v1/catalog/service/elasticsearch-9200 | awk -v RS=',"' -F: '/^ServicePort/ {print $2}' | sed "s/}]//g"
@cgswong
cgswong / [email protected]
Created February 12, 2015 15:54
Elasticsearch service
[Unit]
Description=ElasticSearch service
After=docker.service
Requires=docker.service
[Service]
TimeoutSec=180
EnvironmentFile=/etc/environment
ExecStartPre=/usr/bin/mkdir -p /data/es
@cgswong
cgswong / [email protected]
Created February 12, 2015 15:49
Elasticsearch discovery Fleet service
[Unit]
Description=ElasticSearch discovery service
BindsTo=elasticsearch@%i.service
[Service]
EnvironmentFile=/etc/environment
ExecStart=/bin/bash -c '\
while true; do \
curl -f ${COREOS_PRIVATE_IPV4}:9200; \
@cgswong
cgswong / puppet.conf
Created February 10, 2015 02:19
Puppet Configuration
# Settings in [main] are used if a more specific section doesn't set a value.
[main]
always_cache_features = true
dns_alt_names = puppet,puppetmaster
directoryenvironment = $confdir/environments