promtail:
  config:
    snippets:
      # -- `scapeConfigs` is exactly the part of https://grafana.com/docs/loki/latest/clients/promtail/configuration/#scrape_configs
      # -- The value will be created as a Kubernetes ConfigMap and then mounted to the Promtail Pod.
      # -- Not really need to change this value. It's set to scrape all logs of ScalarDL/DB Pods by using regular expression.
      scrapeConfigs: |
        # -- the `scalardl` job scrapes all the logs from Scalar Ledger Pods, Scalar Auditor Pods, and the corresponding Envoy Pods
        - job_name: scalardl
          pipeline_stages:
            - docker: {}
          kubernetes_sd_configs:
            - role: pod
          relabel_configs:
            - source_labels:
                - __meta_kubernetes_pod_node_name
              target_label: __host__
            - action: replace
              source_labels:
                - __meta_kubernetes_pod_name
              target_label: pod
            - action: keep
              regex: (.*)scalardl-(.+)
              source_labels:
                - pod
            - replacement: /var/log/pods/*$1/*.log
              separator: /
              source_labels:
                - __meta_kubernetes_pod_uid
                - __meta_kubernetes_pod_container_name
              target_label: __path__
        # -- the `scalardb` job scrapes all the logs of ScalarDB Server Pods and the corresponding Envoy Pods
        - job_name: scalardb
          pipeline_stages:
            - docker: {}
          kubernetes_sd_configs:
            - role: pod
          relabel_configs:
            - source_labels:
                - __meta_kubernetes_pod_node_name
              target_label: __host__
            - action: replace
              source_labels:
                - __meta_kubernetes_pod_name
              target_label: pod
            - action: keep
              regex: (.*)scalardb-(.+)
              source_labels:
                - pod
            - replacement: /var/log/pods/*$1/*.log
              separator: /
              source_labels:
                - __meta_kubernetes_pod_uid
                - __meta_kubernetes_pod_container_name
              target_label: __path__
        # -- the `scalar-admin-for-kubernetes` job scrapes all the logs of Scalar Admin for Kubernetes Pods
        - job_name: scalar-admin-for-kubernetes
          pipeline_stages:
            - docker: {}
            - cri: {}
          kubernetes_sd_configs:
            - role: pod
          relabel_configs:
            - source_labels:
                - __meta_kubernetes_pod_node_name
              target_label: __host__
            - action: replace
              source_labels:
                - __meta_kubernetes_pod_name
              target_label: pod
            - action: keep
              regex: (.*)scalar-admin-for-kubernetes-(.+)
              source_labels:
                - pod
            - replacement: /var/log/pods/*$1/*.log
              separator: /
              source_labels:
                - __meta_kubernetes_pod_uid
                - __meta_kubernetes_pod_container_name
              target_label: __path__
