LoginSignup
1
2

More than 5 years have passed since last update.

fluentd で UltraMonkey-L7 のアクセスログを投げるための設定

Last updated at Posted at 2015-10-18

はじめに

Layer-7 ロードバランサ UltraMonkey-L7 のアクセスログを fluentd で外に投げる時の設定です.

ログのフォーマットについて

UltraMonkey-L7 ではアクセスログ(どのクライアントから受け付けて,どの仮想サーバで受け付けて,どのリアルサーバに振ったか)を記録することができます.
下記の形式で記録されます.

2015/10/18 07:52:10 [INFO] [ [AccessLog] (CL)192.168.0.1:1699 --> 192.168.0.116:8080 --UM-- 192.168.0.116:38320 --> (RS-DST)192.168.0.116:80 ] 0x7f7da77eb700

それぞれ

日時 [ログレベル] [ [AccessLog] (CL)クライアントエンドポイント --> 仮想サーバエンドポイント --UM-- 仮想サーバ内部エンドポイント --> (RS-DST)リアルサーバエンドポイント ] スレッドID

これを fluentd で拾います.

fluentd の設定

ログに色々と出ますが,ログレベル,AccessLog の文字列,スレッド ID は拾う必要はありません.
タイムゾーンは JST(+0900)を想定.異なる場合は timezone の値を適切に設定してください.

<source> 
  type tail 
  path /var/log/l7vs/access_log 
  pos_file /var/log/td-agent/l7vs.access_log.pos 
  tag ultramonkeyl7.accesslog 
  format /(?<time>[^ ]\S+ \S+).*\(CL\)(?<client_ip>[^ ]\S+):(?<client_port>[^ ]\S+) --> (?<virtual_service>[^ ]\S+) --UM-- (?<vs_inner_ep>[^ ]\S+) --> \(RS-DST\)(?<realserver_ep>[^ ]\S+) \].*$/  
  time_format %Y/%m/%d %H:%M:%S 
  timezone +0900
</source>

これで下記のように投げられます.

key value
time 2015/10/18 07:52:10 +0900
client_ip 192.168.0.1
client_port 1699
virtual_service 192.168.0.116:8080
vs_inner_ep 192.168.0.116:38320
realserver_ep 192.168.0.119:80

次回はこれを Elasticsearch + Kibana で可視化してみます.

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2