2010
#------------------------------------------------------------------------------
# ファイル名の定義
#------------------------------------------------------------------------------
template(name="ByPodContainer" type="list") {
constant(value="/LOG/kafka/")
property(name="$!openshift!labels!cluster" securePath="replace")
constant(value="/")
property(name="$!kubernetes!namespace_name" securePath="replace")
constant(value="/")
property(name="$!kubernetes!pod_name" securePath="replace")
constant(value="_")
property(name="$!kubernetes!container_name" securePath="replace")
constant(value=".log")
}
template(name="ByNamespaceAll" type="list") {
constant(value="/LOG/kafka/")
property(name="$!openshift!labels!cluster" securePath="replace")
constant(value="/")
property(name="$!kubernetes!namespace_name" securePath="replace")
constant(value="/raw.log")
}
template(name="KafkaAuditDaily" type="list") {
constant(value="/LOG/audit/kafka/")
property(name="$!openshift!labels!cluster" securePath="replace")
constant(value="/")
property(name="$!kubernetes!namespace_name" securePath="replace")
constant(value="/kafka_audit_")
property(name="timereported" dateFormat="year")
property(name="timereported" dateFormat="month")
property(name="timereported" dateFormat="day")
constant(value=".log")
}
#------------------------------------------------------------------------------
# ファイル中身のフォーマット定義
#------------------------------------------------------------------------------
template(name="MessageLine" type="string" string="%$!message%\n")
template(name="RawLine" type="string" string="%rawmsg%\n")
#------------------------------------------------------------------------------
# ログ出力(対象namespaceのみ)
#------------------------------------------------------------------------------
if ($!kubernetes!namespace_name == "bkmpl0-201" or $!kubernetes!namespace_name == "bkmpl0-202") then {
action(type="omfile" dynaFile="ByPodContainer" template="MessageLine" createDirs="on")
action(type="omfile" dynaFile="ByNamespaceAll" template="RawLine" createDirs="on")
# 監査ログ
if (re_match($!message, "\\[data-plane-kafka-request-handler-[0-9]+\\]")) then {
action(type="omfile" dynaFile="KafkaAuditDaily" template="MessageLine" createDirs="on")
}
}
# Type Path Mode UID GID Age Argument
# 15日以上更新のないKafkaログを削除
r /LOG/kafka/*/*/*.log - - - 15d -
# 15日以上更新のないKafka監査ログを削除
r /LOG/audit/kafka/*/*/*.log - - - 15d -