Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docker/all-in-one/etc/vector/vector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ sources:
include:
- /var/log/services/pgbouncer.log

pitr_log:
type: file
include:
- /var/log/wal-g/pitr.log
read_from: end

postgres_log:
type: file
include:
Expand Down Expand Up @@ -208,6 +214,33 @@ transforms:
del(._UID)
del(.__MONOTONIC_TIMESTAMP)
del(.__REALTIME_TIMESTAMP)

pitr_to_object:
inputs:
- pitr_log
type: remap
source: |2-
.project = "{{ .ProjectRef }}"

.parsed, err = parse_key_value(.message)
if err == null {
.metadata = .parsed
.metadata.host = del(.host)
.message = del(.metadata.msg)
.timestamp = del(.metadata.time)
}

del(.parsed)
del(.source_type)
del(.file)

filter_pitr_error:
inputs:
- pitr_to_object
type: filter
condition: >
.metadata.level != "info"

sinks:
http_gotrue:
type: "http"
Expand Down Expand Up @@ -242,6 +275,15 @@ sinks:
compression: none
uri: "https://{{ .LogflareHost }}/logs?api_key={{ .ApiKey }}&source={{ .PgbouncerSource }}"

http_pitr_error:
type: http
inputs:
- filter_pitr_error
encoding:
codec: json
compression: none
uri: "https://{{ .LogflareHost }}/logs?api_key={{ .ApiKey }}&source={{ .PitrErrorsSource }}"

http_postgres:
type: http
inputs:
Expand Down
3 changes: 3 additions & 0 deletions docker/all-in-one/init/configure-vector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ if [ -f "${INIT_PAYLOAD_PATH:-}" ]; then
LOGFLARE_GOTRUE_SOURCE=$(jq -r '.["logflare_gotrue_source"]' /etc/vector/init.json)
LOGFLARE_POSTGREST_SOURCE=$(jq -r '.["logflare_postgrest_source"]' /etc/vector/init.json)
LOGFLARE_PGBOUNCER_SOURCE=$(jq -r '.["logflare_pgbouncer_source"]' /etc/vector/init.json)
LOGFLARE_PITR_ERRORS_SOURCE=$(jq -r '.["logflare_pitr_errors_source"]' /etc/vector/init.json)
LOGFLARE_API_KEY=$(jq -r '.["logflare_api_key"]' /etc/vector/init.json)
fi

Expand Down Expand Up @@ -42,6 +43,7 @@ LOGFLARE_DB_SOURCE=${LOGFLARE_DB_SOURCE:-postgres.logs}
LOGFLARE_GOTRUE_SOURCE=${LOGFLARE_GOTRUE_SOURCE:-gotrue.logs.prod}
LOGFLARE_POSTGREST_SOURCE=${LOGFLARE_POSTGREST_SOURCE:-postgREST.logs.prod}
LOGFLARE_PGBOUNCER_SOURCE=${LOGFLARE_PGBOUNCER_SOURCE:-pgbouncer.logs.prod}
LOGFLARE_PITR_ERRORS_SOURCE=${LOGFLARE_PITR_ERRORS_SOURCE:-pitr_errors.logs.prod}

sed -i "s|{{ .ApiPort }}|$VECTOR_API_PORT|g" $VECTOR_CONF
sed -i "s|{{ .ProjectRef }}|$PROJECT_REF|g" $VECTOR_CONF
Expand All @@ -51,3 +53,4 @@ sed -i "s|{{ .DbSource }}|$LOGFLARE_DB_SOURCE|g" $VECTOR_CONF
sed -i "s|{{ .GotrueSource }}|$LOGFLARE_GOTRUE_SOURCE|g" $VECTOR_CONF
sed -i "s|{{ .PostgrestSource }}|$LOGFLARE_POSTGREST_SOURCE|g" $VECTOR_CONF
sed -i "s|{{ .PgbouncerSource }}|$LOGFLARE_PGBOUNCER_SOURCE|g" $VECTOR_CONF
sed -i "s|{{ .PitrErrorsSource }}|$LOGFLARE_PITR_ERRORS_SOURCE|g" $VECTOR_CONF