Skip to content

Instantly share code, notes, and snippets.

View garlandkr's full-sized avatar
🎯
Focusing

Ken Garland garlandkr

🎯
Focusing
View GitHub Profile
@garlandkr
garlandkr / statsd_init.sh
Created August 29, 2012 16:39
statsd init.d script with forever nodejs support
#!/bin/sh
### BEGIN INIT INFO
# Provides: statsd
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the statsd node server
# Description: starts statsd using nodejs forever
@garlandkr
garlandkr / gist:3539790
Created August 30, 2012 20:15
Curl::Err::HostResolutionError
Curl::Err::HostResolutionError - Curl::Err::HostResolutionError:
/var/lib/gems/1.8/gems/curb-0.8.1/lib/curl/easy.rb:60:in `perform'
./lib/kelastic.rb:42:in `all_indices'
./lib/kelastic.rb:54:in `index_range'
kibana.rb:56:in `GET /api/search/:hash'
/var/lib/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:1264:in `call'
/var/lib/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:1264:in `compile!'
/var/lib/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `[]'
/var/lib/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:835:in `route!'
/var/lib/gems/1.8/gems/sinatra-1.3.3/lib/sinatra/base.rb:851:in `route_eval'
@garlandkr
garlandkr / redis_es_ls.md
Created September 20, 2012 01:28
Installing Redis Elasticsearch and Logstash

This will be a copy/paste doc for installing redis, elasticsearch and logstash on ubuntu 12.04

Pre-Requisites

apt-get update
apt-get upgrade
apt-get install tcl8.5 tcl8.5-dev build-essential rubygems git \
htop python-dev openjdk-7-jre-headless libcurl4-openssl-dev \
bison ctags flex gperf libevent-dev libpcre3-dev libssl-dev libreadline6-dev \
libtokyocabinet-dev libncursesw5-dev libxml2-dev libxslt1-dev libsqlite3-dev \
@garlandkr
garlandkr / s3_get_file.py
Created December 14, 2012 19:12
S3 Get File
import sys
import boto
import logging
import argparse
def get_creds():
# By default empty, boto will look for environment variables
# AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY
@garlandkr
garlandkr / jenkins_restore.py
Created December 14, 2012 21:32
Jenkins restoration from thinBackup plugin
import socket
import argparse
import mechanize
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--url", dest="url", required=True,
help="Give the URL for jenkins backup restoration.")
@garlandkr
garlandkr / shipper.conf
Last active December 10, 2015 21:48
logstash shipper skipping postfix/smtpd
input {
tcp {
port => 55514
type => "jenkins"
format => json
}
}
@garlandkr
garlandkr / rsyslog_client.conf
Last active February 24, 2016 12:30
rsyslog with json template for logstash
$template enhanced,"{\"event\":{\"p_proc\":\"%programname%\",\"p_sys\":\"%hostname%\",\"time\":\"%timestamp:::date-rfc3339%\"},\"message\":{\"raw_msg\":\"%rawmsg%\"}}\n",json
*.* @@logcenter:5514;enhanced
@garlandkr
garlandkr / jenkins.conf
Created January 11, 2013 18:21
rsyslog conf for Jenkins
# Import Jenkins log files
$ModLoad imfile # Load the imfile input module
$ModLoad imklog # for reading kernel log messages
$ModLoad imuxsock # for reading local syslog messages
# Cleanup logs
#$InputFileName "/opt/jenkins/Workspace clean-up.log"
#$InputFileTag jenkins-cleanup
#$InputFileStateFile jenkins-cleanup-state
#$InputRunFileMonitor
@garlandkr
garlandkr / logstash_updater.py
Last active December 11, 2015 02:49
Update to the latest Logstash version, requires sh module and lxml (pip install sh lxml) and python headers. If you are on Ubuntu use: apt-get -y install python-dev python-pip libxml2-dev libxslt-dev; pip install lxml sh
#!/usr/bin/python
import re
import sh
import urllib
from lxml import objectify, etree
from distutils.version import StrictVersion
url = "https://logstash.objects.dreamhost.com/" # xml listing of releases
logstash_dir = "/opt/logstash"
@garlandkr
garlandkr / varnish.grok
Created January 22, 2013 17:53
varnish grok pattern
pattern => "%{IPORHOST:remoteip} - - \[%{HTTPDATE:timestamp}\] \"%{WORD:verb} %{NOTSPACE:request} HTTP/%{NUMBER:httpversion}\" (?:%{NUMBER:status}|\(null\)) (?:%{NUMBER:bytes}|-) \"(?:%{NOTSPACE:referrer}|-)\" %{QUOTEDSTRING:agent}"