Skip to content

Instantly share code, notes, and snippets.

@kenjiskywalker
Last active December 10, 2015 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenjiskywalker/4468051 to your computer and use it in GitHub Desktop.
Save kenjiskywalker/4468051 to your computer and use it in GitHub Desktop.
fluentdでmaillogのparserやるとしたら。ただこれエラー処理によって結構変わってくる気がするわ
{"host"=>"hogehoge", "process"=>"postfix/cleanup[20095]", "key"=>"DFFBB46431A", "address"=>"hoge@example.com", "orig_to"=>"hoge", "relay"=>"none", "delay"=>"0.03", "delays"=>"0.03/0/0/0", "dsn"=>"5.7.1", "status"=>"bounced (message content rejected)"}
/^(?<time>\w{3} \d+ (\d+:){2}\d+) (?<host>[^ ]+) (?<process>[^:]+): (?<key>[^:]+): ?((to|from)=<(?<address>[^>]+)>)?, ?(orig_to=<(?<orig_to>[^>]+)>), ?(relay=(?<relay>[^ ]+)), ?(delay=(?<delay>[^ ]+)), ?(delays=(?<delays>[^ ]+)), ?(dsn=(?<dsn>[^ ]+)), ?(status=(?<status>[^,]+))/
Jan 6 20:30:02 hogehoge postfix/cleanup[20095]: DFFBB46431A: to=<hoge@example.com>, orig_to=<hoge>, relay=none, delay=0.03, delays=0.03/0/0/0, dsn=5.7.1, status=bounced (message content rejected)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment