Skip to content

Instantly share code, notes, and snippets.

View sawanoboly's full-sized avatar
🤷‍♂️
🙃

Yukihiko SAWANOBORI sawanoboly

🤷‍♂️
🙃
View GitHub Profile
@sawanoboly
sawanoboly / fluentd.sample.conf
Last active March 22, 2024 04:29
postfix log status line regexp for fluentd(ruby)
<source>
type tail
# format /(?<time>[\w]+\s+[\d]+\s[\d:]+)\s+(?<host>[\w]+)\s+(?<process>[\w\/]+)\[(?<pid>[\d]+)\]\:\s(?<queue_id>[\w]{11}):\s(?<data>.+)/
format /(?<time>[\w]+\s+[\d]+\s[\d:]+)\s+(?<data>.+)/
time_format %b %d %H:%M:%S
path /var/log/mail.log
pos_file /opt/fluentd/tmp/mail.log.pos2
tag raw.postfix.result
</source>
@sawanoboly
sawanoboly / fluentd-source-haproxy.conf
Created July 13, 2012 01:10
syslog-ng setting for haproxy. Divide logs between accesslog and systeminfo.
<source>
type tail
format /(?<c_ip>[\w\.]+):(?<c_port>\d+) \[(?<a_date>.+)\] (?<f_end>[\w-]+) (?<b_end>[\w-]+)\/(?<b_server>[\w-]+) (?<tw>\d+)\/(?<tc>\d
+)\/(?<tt>\d+) (?<bytes>\d+) (?<t_state>[\w-]+) (?<actconn>\d+)\/(?<feconn>\d+)\/(?<beconn>\d+)\/(?<srv_conn>\d+)\/(?<retries>\d+) (?<
srv_queue>\d+)\/(?<backend_queue>\d+)/
time_format %d/%B/%Y:%H:%M:%S
path /var/log/haproxy/haproxy_access.log
pos_file /opt/fluentd/var/pos/haproxy_access.pos
tag haproxy.access
</source>
@sawanoboly
sawanoboly / check_cert_period.rb
Created July 17, 2012 07:39
Checking expiry period of cert by ruby.
#!/usr/bin/env ruby
# -*- coding:utf-8 -*-
require 'socket'
require 'openssl'
require 'timeout'
require 'pp'
include OpenSSL
timeout=15
@sawanoboly
sawanoboly / haproxy.cfg
Created November 15, 2011 10:28
mongos behind haproxy configuration.
global
daemon
user haproxy
group haproxy
log /dev/log daemon info
maxconn 4096
defaults
log global
option dontlognull
@sawanoboly
sawanoboly / filesys_20min.md
Last active February 24, 2023 21:35
[IDCF Cloud] highio.5XL128 vdbench results.
# ./vdbench -f examples/filesys/random_rw                                                                                                                                                 


Vdbench distribution: vdbench50402
For documentation, see 'vdbench.pdf'.

17:05:39.642 input argument scanned: '-fexamples/filesys/random_rw'
17:05:39.694 anchor=/dir1: there will be 1 directories and a maximum of 1000 files under this anchor.
17:05:39.694 Estimated maximum size for this anchor: 125m
@sawanoboly
sawanoboly / Vagrantfile
Last active January 20, 2021 23:52
VagrantでVM起動時に、追加ディスクを作成してアタッチ - VirtualBox Provider ref: http://qiita.com/sawanoboly/items/cbd056252a130a4b961e
# -- snip --
config.vm.define machine do |config|
config.vm.provider :virtualbox do |vb|
at_disk = 'tmp/name_of_file.vdi'
unless File.exists?(at_disk)
vb.customize ['createhd', '--filename', at_disk, '--size', 5 * 1024]
end
vb.customize ['storageattach', :id, '--storagectl', 'IDE Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', at_disk]
end
@sawanoboly
sawanoboly / .mongorc.js
Created November 14, 2011 09:41
Sample .mongorc.js for replicaSets.
prompt = function() {
// set version
version = db.version();
// case mongos
if (rs.status().info == 'mongos') {
return rs.status().info + ':[' + version + '] > ';
}
// config or replica
@sawanoboly
sawanoboly / config.ru
Last active May 8, 2019 10:58
SphinxをShinatraでホストしつつGithubのOAuth経由でチーム認証をかけたが ref: http://qiita.com/sawanoboly/items/9646c4c53d442a7c6b46
require 'sinatra'
require 'sinatra_auth_github'
set :public_folder, File.dirname(__FILE__) + '/build/html'
use Rack::Session::Cookie,
:secret => Digest::SHA1.hexdigest(rand.to_s),
:expire_after => 3600
set :github_options, {
:scopes => "user",
@sawanoboly
sawanoboly / 0.8.12_smartos.patch
Last active April 7, 2017 20:11
fail2ban for SmartOS patch
diff --git a/config/action.d/ipfilter.conf b/config/action.d/ipfilter.conf
index 61420e3..091c92d 100644
--- a/config/action.d/ipfilter.conf
+++ b/config/action.d/ipfilter.conf
@@ -13,14 +13,14 @@
# Values: CMD
#
# enable IPF if not already enabled
-actionstart = /sbin/ipf -E
+actionstart = /usr/sbin/ipf -E
@sawanoboly
sawanoboly / app.rb
Last active December 31, 2015 17:39
Settingslogicを使ってconfig.yml, config.local.yml運用してみる ref: http://qiita.com/sawanoboly/items/1d776006ed24513e1b55
require 'settingslogic'
class EnvSettings < Settingslogic
source File.expand_path('../config.yml', __FILE__)
end
if File.exist?(File.expand_path('../config.local.yml', __FILE__))
class EnvLocalSettings < Settingslogic
source File.expand_path('../config.local.yml', __FILE__)
end