0bdb1d02e0
So far the install-script could only create a single promtail config.
Since the monitoring setup is able to monitor multiple Gerrit servers,
this caused manual work to create a promtail config per Gerrit server.
Now ytt will create a configuration for each Gerrit host configured
in the config.yaml. Ytt is only able to do that in a single file. Thus,
csplit is used to split the files into separate files that can then
be used to configure promtail on the respective hosts. The config-
files can then be found under
$OUTPUT/promtail/promtail-$GERRIT_HOSTNAME.yaml.
Change-Id: Ib09fba83d8a8fbd45b42e9e5388a85a37ab1a952
93 lines
2.5 KiB
YAML
93 lines
2.5 KiB
YAML
#@ 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
|