| #@ load("@ytt:data", "data") |
| |
| #@ for i in range(len(data.values.gerritServers)): |
| --- |
| server: |
| http_listen_port: 9080 |
| grpc_listen_port: 0 |
| |
| positions: |
| filename: #@ "{}/positions.yaml".format(data.values.gerritServers[i].promtail.storagePath) |
| |
| clients: |
| - url: #@ "https://{}/loki/api/v1/push".format(data.values.loki.host) |
| tls_config: |
| insecure_skip_verify: #@ data.values.tls.skipVerify |
| #@ if not data.values.tls.skipVerify: |
| ca_file: #@ "{}/promtail.ca.crt".format(data.values.gerritServers[i].promtail.storagePath) |
| #@ end |
| basic_auth: |
| username: #@ data.values.loki.username |
| password: #@ data.values.loki.password |
| scrape_configs: |
| - job_name: gerrit_error |
| static_configs: |
| - targets: |
| - localhost |
| labels: |
| job: gerrit_error |
| __path__: #@ "{}/error_log.json".format(data.values.gerritServers[i].promtail.logPath) |
| host: #@ data.values.gerritServers[i].host |
| entry_parser: raw |
| pipeline_stages: |
| - json: |
| expressions: |
| timestamp: '"@timestamp"' |
| message: |
| - template: |
| source: timestamp |
| template: '{{ Replace .Value "," "." 1 }}' |
| - template: |
| source: timestamp |
| template: '{{ Replace .Value "Z" " +0000" 1 }}' |
| - template: |
| source: timestamp |
| template: '{{ Replace .Value "T" " " 1 }}' |
| - timestamp: |
| source: timestamp |
| format: "2006-01-02 15:04:05.999 -0700" |
| - regex: |
| source: message |
| expression: "Gerrit Code Review (?P<gerrit_version>.*) ready" |
| - labels: |
| gerrit_version: |
| - job_name: gerrit_httpd |
| static_configs: |
| - targets: |
| - localhost |
| labels: |
| job: gerrit_httpd |
| __path__: #@ "{}/httpd_log.json".format(data.values.gerritServers[i].promtail.logPath) |
| host: #@ data.values.gerritServers[i].host |
| entry_parser: raw |
| pipeline_stages: |
| - json: |
| expressions: |
| timestamp: |
| - template: |
| source: timestamp |
| template: '{{ Replace .Value "," "." 1 }}' |
| - timestamp: |
| source: timestamp |
| format: '02/Jan/2006:15:04:05.999 -0700' |
| - job_name: gerrit_sshd |
| static_configs: |
| - targets: |
| - localhost |
| labels: |
| job: gerrit_sshd |
| __path__: #@ "{}/sshd_log.json".format(data.values.gerritServers[i].promtail.logPath) |
| host: #@ data.values.gerritServers[i].host |
| entry_parser: raw |
| pipeline_stages: |
| - json: |
| expressions: |
| timestamp: |
| - template: |
| source: timestamp |
| template: '{{ Replace .Value "," "." 1 }}' |
| - timestamp: |
| source: timestamp |
| format: 2006-01-02 15:04:05.999 -0700 |
| #@ end |