Skip to content

Instantly share code, notes, and snippets.

View phumpal's full-sized avatar
🌮

Patrick Humpal phumpal

🌮
  • Northern California
View GitHub Profile
## Based of config provided by logstash ... modified to suit our captures
## Documentation of the haproxy log formats can be found at the following links:
## http://code.google.com/p/haproxy-docs/wiki/HTTPLogFormat
## http://code.google.com/p/haproxy-docs/wiki/TCPLogFormat
HAPROXYTIME (?!<[0-9])%{HOUR:haproxy_hour}:%{MINUTE:haproxy_minute}(?::%{SECOND:haproxy_second})(?![0-9])
HAPROXYDATE %{MONTHDAY:haproxy_monthday}/%{MONTH:haproxy_month}/%{YEAR:haproxy_year}:%{HAPROXYTIME:haproxy_time}.%{INT:haproxy_milliseconds}
{"lastUpload":"2019-10-06T18:32:39.184Z","extensionVersion":"v3.4.3"}
@omame
omame / zfs-arc-statsd.sh
Created April 1, 2015 16:44
Send ZFS Linux metrics to statsd
#!/bin/bash
# A port of ZFS stats for FreeBSD plugin to Linux, adapted to send metrics to statsd.
#
# Author: Daniele Valeriani <daniele@valeriani.co.uk>
# Author of the original munin plugin: David Bjornsson <dabb@lolnet.is>
# Author of the Linux port: Alex Chistyakov <alexclear@gmail.com>
PREFIX="servers.`hostname`.zfs"
STATSD_ADDR="YOUR STATSD SERVER"
@johanneslamers
johanneslamers / craftcms_varnish.vcl
Last active February 26, 2019 02:46 — forked from aelvan/gist:eba03969f91c1bd51c40
Varnish 4.0 file for our Craft CMS projects
# Varnish 4.0 file for our Craft CMS projects
# Based on https://github.com/mattiasgeniar/varnish-4.0-configuration-templates/blob/master/default.vcl
#
# This is still work in progress, comments appreciated.
vcl 4.0;
import std;
import directors;
@hacksalot
hacksalot / gist:72517b9b1c145116e89e
Created March 17, 2015 02:01
Delete GitHub wiki revisions
# Delete prior revisions from a GitHub wiki so that only the most-recent
# version of the content is available.
# Clone the wiki.
git clone https://github.com/[user]/[repo].wiki.git
# Remove the .git folder.
rm -rf .git
# Reconstruct the local repo with only latest content
@jirutka
jirutka / gitlab-sidekiq.conf
Last active March 18, 2016 05:28
Upstart job configuration files (aka runscripts) for GitLab CE.
#!upstart
description "GitLab (Sidekiq)"
author "Jakub Jirutka"
start on starting gitlab
stop on stopping gitlab
env sidekiq_logfile="/var/log/gitlab/sidekiq.log"
env sidekiq_queues="-q post_receive -q mailer -q system_hook
@mjpowersjr
mjpowersjr / gist:740a9583e9ec8b49e0a3
Last active May 2, 2024 01:26
Parsing the MySQL slow query log via Logstash (the easy way?)

The MySQL slow query log is a difficult format to extract information from. After looking at various examples with mixed results, I realized that it's much easier to configure MySQL to write the slow query log to a table in CSV format!

From the MySQL documentation:

By default, the log tables use the CSV storage engine that writes data in comma-separated values format. For users who have access to the .CSV files that contain log table data, the files are easy to import into other programs such as spreadsheets that can process CSV input.

my.cnf

Note: don't forget to open up permissions on your slow query log CSV file so logstash can read it!

# enable slow query log
@yusufhm
yusufhm / logstash-ossec-alerts.conf
Last active May 22, 2017 16:54
Logstash configuration for reading OSSEC alerts files and send to Elasticsearch (credits to https://mig5.net)
input {
file {
type => "ossec"
path => "/var/ossec/logs/alerts/alerts.log"
sincedb_path => "/opt/logstash/"
codec => multiline {
pattern => "^\*\*"
negate => true
what => "previous"
}
@mynameisrufus
mynameisrufus / Vagrantfile
Last active July 15, 2016 19:31
Vagrant dynamic port mapping
# -*- mode: ruby -*-
# vi: set ft=ruby :
require 'yaml'
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
# Load mappings.yml
MAPPINGS = YAML.load_file('mappings.yml')
@dylanmei
dylanmei / Haproxy logstash to StatsD
Last active July 25, 2017 21:27
Haproxy logstash to StatsD
input {
tcp {
port => 5140
type => "haproxy"
}
}
filter {
grok {
# break the input "message" into two parts: a priority structure,