Shibboleth-IdPのログをfluentdのin_tailで拾うための正規表現

Shibboleth-IdPも複数台で運用して
ログも分散するようになって集計も面倒になってきたので
fluentdで集約してみようと一念発起

Shibboleth-IdPのログはマニュアル
IdPLogging - Shibboleth 2.x - Confluence
に書かれているが要はパイプ'|'で区切ってログ情報が出力されている
ただしidp-audit.logのserverHostとserverPortの区切りがコロン':'なので注意

fluent.confには

<source>
  type tail
  path /opt/shibboleth-idp-2.4.0/logs/idp-access.log
  format /^(?<time>[^\|]+)\|(?<remoteHost>[^\|]*)\|(?<serverHost>[^\:]*)\:(?<serverPort>[^\|]*)\|(?<requestPath>[^\|]*)\|$/
  time_format %Y%m%dT%H%M%S%Z
  tag shibboleth-idp.access
</source>
<source>
  type tail
  path /opt/shibboleth-idp-2.4.0/logs/idp-audit.log
  format /^(?<time>[^\|]+)\|(?<requestBinding>[^\|]*)\|(?<requestId>[^\|]*)\|(?<releyingPartyId>[^\|]*)\|(?<messageProfileId>[^\|]*)\|(?<assertingPartyId>[^\|]+)\|(?<responseBinding>[^\|]*)\|(?<responseId>[^\|]*)\|(?<principalName>[^\|]*)\|(?<authNMethod>[^\|]*)\|(?<releasedAttributeId>[^\|]*)\|(?<nameIdentifier>[^\|]*)\|(?<assertionID>[^\|]*)\|$/
  time_format %Y%m%dT%H%M%S%Z
  tag shibboleth-idp.audit
</source>

と書くとよさそう

下記でテストできた
fluentdのformat(正規表現)の作り方について試行錯誤中 #fluentd - Glide Note - グライドノート
Fluentdでparser用の正規表現を書く・試す - tagomorisのメモ置き場
Fluentular: a Fluentd regular expression editor