Skip to content

Instantly share code, notes, and snippets.

View doryokujin's full-sized avatar

doryokujin doryokujin

View GitHub Profile
@doryokujin
doryokujin / gist:1251708
Created September 29, 2011 19:36
fluent-plugin-redis
module Fluent
class RedisOutput < Fluent::BufferedOutput
Fluent::Plugin.register_output('redis', self)
def initialize
super
require 'redis'
require 'msgpack'
end
@doryokujin
doryokujin / gist:1257119
Created October 2, 2011 05:54
MongoOutput included event time #2
module Fluent
class MongoOutput < BufferedOutput
Fluent::Plugin.register_output('mongo', self)
def initialize
super
require 'mongo'
require 'msgpack'
@doryokujin
doryokujin / gist:1258927
Created October 3, 2011 11:33
manage rvm and gem using fabric
# -*- coding: utf-8 -*-
#
# install: http://morgangoose.com/blog/2011/01/06/using-the-parallel-branch-of-fabric/
# document: http://docs.fabfile.org/en/1.2.0/index.html
#
import os
from fabric.api import *
from fabric.decorators import *
@doryokujin
doryokujin / _fluent.exapmle.conf
Created October 4, 2011 06:39
NoSQLAggregatedOutput #fluent
# my host is host4
<source>
type redis_dumper
tag reduce_redis
host host1
port 6003
delay 10
time_suffix s
key key1,key2,key3
@doryokujin
doryokujin / fluent.shuffle.conf
Created October 4, 2011 20:45
How to write format_stream?
#
# shuffle record partitioned by reduce_key
#
<match shuffle**>
type shuffle
reduce_key type
<reducer>
type shuffle_tcp
host delta5
port 24225
@doryokujin
doryokujin / fluent.shuffle.conf
Created October 5, 2011 09:31
Shuffle Stream
## Send massage for servers defined by <forward> tag.
## Each input record are shuffled by key and partition function.
## Multiple keys are o.k.(sep by ',') and partition function is very flexible.
## The shuffle idea is the same as basic MapReduce.
<match shuffle**>
type shuffle
key key1,key2
flush_interval 1s
<forward>
type shuffle_tcp
@doryokujin
doryokujin / gist:1273920
Created October 9, 2011 17:04
include time in fluent out_plugin
require 'time'
...
def format(tag, event)
record = event.record.dup
# if you use a timestamp
timestamp = event.time
record['timestamp'] = timestamp
# if you use a time
time_obj = Time.at(event.time)
record['time'] = time_obj
@doryokujin
doryokujin / fluent.shuffle.conf
Created October 10, 2011 08:00
fluent-plugin-shuffle
<match shuffle**>
type shuffle
key type
flush_interval 1
<forward>
type shuffle_tcp
host delta4
port 24226
</forward>
<forward>
@doryokujin
doryokujin / gist:1294636
Created October 18, 2011 04:54
How to send an javascript event to rails controller within onSelect() function?
// app/views/*/index.rb.html
<% content_for :js do %>
$(document).ready(function() {
var treeview;
var indexes = <%= ActiveSupport::JSON.encode(@indexes).html_safe %>;
function onSelect(e) {
//alert("Selected: " + indexes[treeview.text(e.node)] );
/*
onSelectで要素が選択された時にそれに対するアクションをajaxでなく
<source>
type tail
format /^(?<time>[^ ]* [^ ]*[ ]*[^ ]* [^ ]*) \[(?<type>[^\]]*)\] (?<verb>[^ ]*) (?<object>[^ ]*) (?<message>.*)$/
time_format %a %b %e %H:%M:%S
path /log/mongo/delta6/shard05/mongo.log,/log/mongo/delta6/shard11/mongo.log,/log/mongo/delta6/shard17/mongo.log,/log/mongo/delta6/shard23/mongo.log
tag mongo
</source>
<match mongo**>
type file