Skip to content

Instantly share code, notes, and snippets.

View rafrombrc's full-sized avatar

Rob Miller rafrombrc

  • Mozilla Corp
  • Oakland, CA
View GitHub Profile
@rafrombrc
rafrombrc / stdout.toml
Last active August 29, 2015 14:06
simplest file in -> stdout example heka toml file
[LogstreamerInput]
log_directory = "/var/log"
file_match = 'auth\.log'
[PayloadEncoder]
append_newlines = false
[LogOutput]
message_matcher = "TRUE"
encoder = "PayloadEncoder"
value = "overwrite"
@rafrombrc
rafrombrc / testlisten.go
Created September 12, 2014 21:16
listen testing
package main
import (
"log"
"net"
"time"
)
func accept(l net.Listener, sigBack chan struct{}) {
conn, err := l.Accept()
require "cjson"
local fields = {
values = {},
interval = 0,
plugin = "",
plugin_instance = "",
["type"] = "",
type_instance = ""
}
var tmp map[string]interface{}
tmp, ok = v.(map[string]interface{})
if !ok {
return result, errors.New("invalid path")
}
v, ok = tmp[ss[1]]
if !ok {
return result, errors.New("invalid path")
}
[TcpInput]
address = ":8325"
[StatsToFieldsDecoder]
[scribble_statmetric]
type = "ScribbleDecoder"
[scribble_statmetric.message_fields]
Type = "heka.statmetric"
[TcpInput]
address = ":8325"
decoder = "StatsToFieldsDecoder"
parser_type = "regexp"
delimiter = 'pdxnplogmq01\.ping\.ping_droprate\.127_0_0_1'
delimiter_location = "start"
[StatsToFieldsDecoder]
[stat_graph]
@rafrombrc
rafrombrc / hekad.toml
Created September 27, 2014 01:12
deb minimal default hekad config
[hekad]
maxprocs = 2
[TcpInput]
address = "127.0.0.1:5565"
parser_type = "message.proto"
decoder = "ProtobufDecoder"
[StatAccumInput]
@rafrombrc
rafrombrc / etc_init.d_hekad
Created October 27, 2014 20:55
Experimental RHEL6.4 hekad init script
#!/bin/sh
#
# hekad <summary>
#
# chkconfig: 2345 80 20
# description: Starts and stops a single heka instance on this system
#
### BEGIN INIT INFO
# Provides: Heka
@rafrombrc
rafrombrc / http_req_stat_filter.lua
Last active August 29, 2015 14:18
Sample Heka SandboxFilter emitting graphite format stats from HTTP request data
require "string"
require "math"
require "table"
require "cjson"
local status_codes = {}
local request_times = {}
local ticker_interval = read_config("ticker_interval") or error("must provide ticker_interval")
local percent_thresh = read_config("percent_threshold") or 90