Skip to content

Instantly share code, notes, and snippets.

@masayuki5160
Last active August 29, 2015 13:57
Show Gist options
  • Save masayuki5160/9777643 to your computer and use it in GitHub Desktop.
Save masayuki5160/9777643 to your computer and use it in GitHub Desktop.
td-agentのconf. aggregaterでうまくひとまず収集するところまで.
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;
<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>
<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>
<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>
@masayuki5160
Copy link
Author

2014/3/26 動作チェックはひとまずok.

@masayuki5160
Copy link
Author

td_forwarder_confはこんな雰囲気で大丈夫なはず.
あとは必要に応じてを増やしてtag付けしてaggregaterにぶんなげる.

aggregaterの方は、
・保存先にディレクトリ変更?
・ローカルじゃなくてS3 or DB にいれたいのでそこためす.
・aggregaterが落ちたとき用にHAくむ. でもそんな難しくないはず.

@masayuki5160
Copy link
Author

Installの手順は https://gist.github.com/masayuki5160/9777566 でかいたとおり。
aggregaterについてはtd-agentの設定のみでok.

@masayuki5160
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment