Last active
August 29, 2015 13:57
-
-
Save masayuki5160/9777643 to your computer and use it in GitHub Desktop.
td-agentのconf. aggregaterでうまくひとまず収集するところまで.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE APP_LOG CHARACTER SET utf8; | |
create table if not exists access_log ( | |
id int(10) NOT NULL AUTO_INCREMENT, | |
code int(10) NOT NULL, | |
path varchar(255) NOT NULL, | |
agent varchar(255) NOT NULL, | |
referer varchar(255) NOT NULL, | |
PRIMARY KEY(id) | |
) ENGINE=InnoDB DEFAULT CHARSET=utf8; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<source> | |
type forward | |
port 24224 | |
</source> | |
<match apache.access> | |
type file | |
path /var/log/td-agent/access_log | |
time_slice_format %Y%m%d_%H%M | |
time_slice_wait 30s | |
time_format %Y-%m-%d %H:%M:%S | |
</match> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<source> | |
type forward | |
port 24224 | |
</source> | |
<match apache.access> | |
type mysql | |
host localhost | |
database APP_LOG | |
key_names code,path,agent,referer | |
sql INSERT INTO access_log (code,path,agent,referer) VALUES (?,?,?,?) | |
username root | |
#password "" | |
flush_interval 10s | |
</match> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<source> | |
type tail | |
format apache | |
path /var/log/httpd/access_log | |
tag apache.access | |
</source> | |
<match apache.access> | |
type forward | |
flush_interval 5s | |
<server> | |
host 10.0.0.131 | |
port 24224 | |
</server> | |
</match> |
td_forwarder_confはこんな雰囲気で大丈夫なはず.
あとは必要に応じて
aggregaterの方は、
・保存先にディレクトリ変更?
・ローカルじゃなくてS3 or DB にいれたいのでそこためす.
・aggregaterが落ちたとき用にHAくむ. でもそんな難しくないはず.
Installの手順は https://gist.github.com/masayuki5160/9777566 でかいたとおり。
aggregaterについてはtd-agentの設定のみでok.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
2014/3/26 動作チェックはひとまずok.