Skip to content

Instantly share code, notes, and snippets.

View yteraoka's full-sized avatar

Yoshinori Teraoka yteraoka

View GitHub Profile
@yteraoka
yteraoka / mod_headers-toenv.patch
Created March 6, 2013 10:27
特定の Response Header の値を環境変数にコピーして Header を削除する機能を mod_headers に追加する patch for Apache 2.4.4
diff -uNr httpd-2.4.4.orig/modules/metadata/mod_headers.c httpd-2.4.4/modules/metadata/mod_headers.c
--- httpd-2.4.4.orig/modules/metadata/mod_headers.c 2012-12-09 22:20:13.000000000 +0900
+++ httpd-2.4.4/modules/metadata/mod_headers.c 2013-02-27 19:37:08.466361782 +0900
@@ -96,7 +96,8 @@
hdr_unset = 'u', /* unset header */
hdr_echo = 'e', /* echo headers from request to response */
hdr_edit = 'r', /* change value by regexp, match once */
- hdr_edit_r = 'R' /* change value by regexp, everymatch */
+ hdr_edit_r = 'R', /* change value by regexp, everymatch */
+ hdr_toenv = 'E' /* copy to subprocess_env and unset */
@yteraoka
yteraoka / out_dbi.rb
Last active December 13, 2015 20:08
DBI を使って PostgreSQL でも MySQL にでも出力できる Fluentd Output Plugin https://github.com/yteraoka/fluent-plugin-dbi
# <match dbi.test>
# type dbi
# #dsn DBI:Pg:dbname:127.0.0.1
# dsn DBI:Mysql:dbname:127.0.0.1
# db_user username
# db_pass password
# keys host,time_m,method,uri,protocol,status
# query insert into access_log (host, time, method, uri, protocol, status) values (?, ?, ?, ?, ?, ?)
# </match>
@yteraoka
yteraoka / in_tailasis.rb
Last active December 12, 2015 02:09
fluent-agent-lite のように正規表現なしで行をそのまま一つのキーに突っ込んで取り込む fluentd plugin
module Fluent
class AsisTailInput < TailInput
Plugin.register_input('tailasis', self)
def initialize
super
@parser = nil
end