Skip to content

Instantly share code, notes, and snippets.

View cgswong's full-sized avatar

Stuart Wong cgswong

View GitHub Profile
@cgswong
cgswong / [email protected]
Created January 21, 2015 23:10
Consul Server bootstrap using Fleet and bash scripting
- name: [email protected]
content: |
[Unit]
Description=Consul Server
# Requirements
Requires=docker.service
Requires=fleet.service
Requires=consul-discovery@%i.service
@cgswong
cgswong / consul-discovery.service
Created January 22, 2015 13:57
Consul discovery service for running Consul server via fleetctl command within unit file (still work in progress as this is not working)
- name: consul-discovery.service
command: start
content: |
[Unit]
Description=Enable the consul bootstrap process
# Requirements
Requires=docker.service
Requires=fleet.service
@cgswong
cgswong / logstash.conf
Last active June 24, 2021 18:08
Logstash configuration file.
# #####################################################################
# DESC: Logstash configuration file. Typically forwarding logs to
# Elasticsearch instance.
# #####################################################################
# Where to get input
input {
# Get input from standard input device/interface
stdin {
type => "stdin-type"
@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
@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 / [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 / 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 / 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 / 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 / logstash-syslog.conf
Created March 6, 2015 19:35
logstash syslog configuration
input {
tcp {
port => 5000
type => syslog
}
udp {
port => 5000
type => syslog
}
}