0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

memo

0
Last updated at Posted at 2026-03-09

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 -
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?