Skip to content

Instantly share code, notes, and snippets.

@y-ken
y-ken / nginx.conf
Last active November 19, 2019 08:11
流れに乗ってnginxのログフォーマットにLTSVを採用しました。 2013/03/05リリースのfluentd-0.10.32.gemなら標準のin_tailで、format ltsvとする事でそのまま読み込めます。 proxy先からの応答時間や送出したcookieも記録する汎用的な設定です。
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format ltsv 'domain:$host\t'
'host:$remote_addr\t'
'user:$remote_user\t'
'time:$time_local\t'
'method:$request_method\t'
'path:$request_uri\t'
@y-ken
y-ken / acl.yml
Created June 11, 2018 05:06 — forked from danielnorberg/ acl.yml
Digdag secrets
# System secret ACL policy
---
acl:
operators:
# TD
td:
secrets:
- td.*
td_load:
secrets:
@y-ken
y-ken / fluentd_s3.conf
Created October 15, 2017 07:14
FluentdからS3に1日単位のファイルと1時間単位のファイルで書き出したい時
#
<match apache.**>
@type copy
<store>
@type s3
...snip...
buffer_path /var/log/fluent/s3_hourly
time_slice_format %Y%m%d%h
</store>
@y-ken
y-ken / nginx-elasticsearch-and-kibana3-proxy.conf
Last active December 27, 2015 23:49
Route Kibana-v3 and plugins of Head/bigdesk requests to ElasticSearch with authenticated user's own index with an Nginx reverse-proxy.
#
# Nginx proxy for Elasticsearch + Kibana
#
# In this setup, we are password protecting the saving of dashboards. You may
# wish to extend the password protection to all paths.
#
# Even though these paths are being called as the result of an ajax request, the
# browser will prompt for a username/password on the first request
#
# If you use this, you'll want to point config.js at http://FQDN:80/ instead of
@y-ken
y-ken / file0.conf
Last active December 18, 2015 01:50
FluentdでApacheのエラーログを収集する正規表現 ref: http://qiita.com/y-ken/items/b302b73d0721162ff401
<source>
type tail
path /var/log/httpd/error_log
format /^(\[(?<time>[^\]]*)\] \[(?<level>[^\]]+)\] (\[client (?<host>[^\]]*)\] )?(?<message>.*)|(?<message>.*))$/
time_format %a %b %d %H:%M:%S %Y
tag apache.error
pos_file /var/log/td-agent/apache_error.pos
</source>
# 送り先を Fluentd の標準ログへ出力します
@y-ken
y-ken / mroonga-memory.md
Created May 8, 2013 15:04
mroongaの動作が不安定になるタイミングとメモリ使用量に関係性がありそうです。

OOM-Killer発動タイミング

環境

$ cat /etc/redhat-release
CentOS release 6.4 (Final)

$ rpm -qa | grep -i -E "(oon|mecab|mysql)"|sort
groonga-libs-3.0.3-0.el6.x86_64
@y-ken
y-ken / mroonga-CREATE-TABLE-IF-NOT-EXISTS.md
Last active December 17, 2015 02:49
mroongaでも以下SQLコマンドが利用可能なようです。もし差し支えなければ、ドキュメントの追加をご検討頂けると幸いです。 http://mroonga.org/ja/docs/reference.html

CREATE TABLE IF NOT EXISTS table_name (...)形式での動作テストは以下の通りです。

環境

  • CentOS-6.4
  • MySQL-5.6.11
  • mysql-mroonga-3.03

InnoDBでの動作

@y-ken
y-ken / mysql-mroonga-3.02.md
Last active December 16, 2015 22:28
mroonga-3.03では、FULLTEXT INDEXに対するノーマライザーの指定がCOMMENTを用いて出来るようになりました。 しかし、インデックスコメント以外にも作用している挙動が見受けられます。 https://github.com/mroonga/mroonga/commit/7165b02b8e2bbab12995e3710c68d994f9308442#ha_mroonga.cpp

mysql-mroonga-3.02 での挙動

$ mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 359
Server version: 5.6.10-log MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
@y-ken
y-ken / vagrant_x86_64.txt
Created March 16, 2013 00:17
Vagrantはgemだけでなく、RPMパッケージを利用したインストールも出来るようです。 システム側のRubyバージョンに依存することなく利用できるので大変便利です。 http://y-ken.hatenablog.com/entry/2013/03/16/184732
$ rpm -qlpi vagrant_x86_64.rpm
Name : vagrant Relocations: /
Version : 1.1.0 Vendor: @localhost.localdomain
Release : 1 Build Date: Thu 14 Mar 2013 03:23:41 PM JST
Install Date: (not installed) Build Host: localhost.localdomain
Group : default Source RPM: vagrant-1.1.0-1.src.rpm
Size : 47447725 License: unknown
Signature : (none)
Packager : <@localhost.localdomain>
URL : http://example.com/no-uri-given
@y-ken
y-ken / fluentd-mixin-example.txt
Last active December 14, 2015 13:08
I'd like to support mixin for my Fluentd Plugins. But It won't work. Would you please tell me the way to work fine? (FluentdプラグインのMixin対応を行おうとしているが、期待した動作にならない訳は何故でしょうか。)
### Test Run Command(テスト実行したコマンド)
curl http://localhost:8888/test -F 'json={"message":"foo"}'
### actual logging output(実際のログ出力)
2013-03-06 00:14:53 +0900 debug.mixin: {"message":"foo"}
### expected logging output(期待したログ出力)
2013-03-06 00:14:53 +0900 debug.mixin: {"message":"foo","my_tag":"test","my_time":"2013-03-05T15:14:53Z"}