Skip to content

Instantly share code, notes, and snippets.

log_format logstash_json '{ "@timestamp": "$time_iso8601", '
'"remote_addr": "$remote_addr", '
'"remote_user": "$remote_user", '
'"body_bytes_sent": "$body_bytes_sent", '
'"request_time": "$request_time", '
'"status": "$status", '
'"request": "$request", '
'"request_method": "$request_method", '
'"http_referrer": "$http_referer", '
'"http_cookie": "$http_cookie", '
package[uchiwa] (uchiwa::repo line 56) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
---- Begin output of apt-get -q -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install uchiwa=0.4.1-1 ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
STDERR: E: Version '0.4.1-1' for 'uchiwa' was not found
---- End output of apt-get -q -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install uchiwa=0.4.1-1 ----
Ran apt-get -q -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" install uchiwa=0.4.1-1 returned 100
@willejs
willejs / gist:347ec18cd4683bbab5a3
Last active August 29, 2015 14:19
sprout-wrap-bootstrap
#!/bin/bash
set -e
# Read SPROUTREPO from environment or use default crowdsurge repo
: ${SPROUTREPO:="https://github.com/crowdsurge/sprout-wrap.git"}
### Define some helper functions ###
usage() {
cat << _EOF_
Usage: "$0" [options]
@willejs
willejs / gist:5873147
Created June 27, 2013 00:50
check_ntp.py checks ntp time
#!/usr/bin/python
import re
import sys
import os
import getopt
def help():
print ''
print 'Usage: check_ntp.py -b ntpq_binary'
@willejs
willejs / gist:6061500
Created July 23, 2013 10:46
example wrapper cookbook
#
# Cookbook Name:: spaceape_logstash
# Recipe:: default
#
# Copyright 2013, Space Ape Games
#
# All rights reserved - Do Not Redistribute
#
node.override['logstash']['agent']['xms'] = '128M'
@willejs
willejs / gist:6906675
Created October 9, 2013 19:19
logstash template
{ "template" : "logstash*",
"settings" : {
"number_of_shards" : 20,
"index.store.compress.stored" : true
},
"mappings" : {
"_default_" : {
"_all" : {"enabled" : false},
"properties" : {
"@fields" : {
@willejs
willejs / gist:6917721
Created October 10, 2013 12:42
get cpu percent per core for a pid usage: ./pid.py <pid-no-here>
#!/usr/bin/python
import os
import sys
core = { 0:float(0.0), 1:float(0.0), 2:float(0.0), 3:float(0.0), 4:float(0.0), 5:float(0.0), 6:float(0.0), 7:float(0.0) }
output = []
for i in os.popen('ps -p {} -L -o pid,tid,psr,pcpu'.format(str(sys.argv[1]))):
output.append(i.rstrip('\n').split())
@willejs
willejs / gist:7101360
Created October 22, 2013 14:05
enable RPS ec2
### bind different buffers to different cores using multi queue networking
### http://engineering.pinterest.com/post/53467339970/building-pinterest-in-the-cloud
### reduces effects of irq affinity on EC2/Xen
execute "rps_cpu" do
command "echo f > /sys/class/net/eth0/queues/rx-0/rps_cpus"
user "root"
group "root"
not_if "grep 1 /sys/class/net/eth0/queues/rx-0/rps_cpus"
action :run
@willejs
willejs / gist:7201687
Created October 28, 2013 18:09
logstash elasticsearch template
{
"order": 0,
"template": "logstash-*",
"settings": {
"index.store.compress.stored": "true",
"index.number_of_shards": "20"
},
"mappings": {
"_default_": {
"properties": {
@willejs
willejs / hello.yaml
Last active July 6, 2016 15:57
Example kubernetes deployment and service
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: hello
spec:
replicas: 1
template:
metadata:
labels:
app: hello