ELBのアクセスログのfluentdプラグイン、fluent-plugin-elb-access-logを作りました。
https://github.com/winebarrel/fluent-plugin-elb-access-log
既存の同様のプラグイン、fluent-plugin-elb-logとの違いは
です。
使い方
fluentd.confは以下のように設定します。
<source> type elb_access_log account_id 123456789012 # required s3_bucket my-bucket # required region us-west-1 # required </source>
プレフィックス付きでオブジェクトをなめるために、account_id/regionは必須です。
5分ほど待ってS3にアクセスログが作成されると、以下のようなレコードが出力されます。
// elb.access_log: { "timestamp":"2015-05-24T08:25:36.229576Z", "elb":"hoge", "client_port":"14.14.124.20:52232", "backend_port":"10.0.199.184:80", "request_processing_time":5.5e-05, "backend_processing_time":0.000893, "response_processing_time":5.7e-05, "elb_status_code":200, "backend_status_code":200, "received_bytes":0, "sent_bytes":3, "request":"GET http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/ HTTP/1.1", "request.method":"GET", "request.uri":"http://hoge-1876938939.ap-northeast-1.elb.amazonaws.com:80/", "request.http_version":"HTTP/1.1", "request.uri.scheme":"http", "request.uri.userinfo":null, "request.uri.host":"hoge-1876938939.ap-northeast-1.elb.amazonaws.com", "request.uri.port":80, "request.uri.registry":null, "request.uri.path":"/", "request.uri.opaque":null, "request.uri.query":null, "request.uri.fragment":null }