Skip to content

Commit

Permalink
Merge branch 'develop' into bma/docker-aio-no-pgbouncer
Browse files Browse the repository at this point in the history
  • Loading branch information
bmpandrade authored Mar 22, 2024
2 parents 0a5437b + 48e23e9 commit 33b6636
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docker/all-in-one/etc/vector/vector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ sources:
include:
- /var/log/services/postgrest.log

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

postgres_log:
type: file
include:
Expand Down Expand Up @@ -168,6 +174,32 @@ transforms:
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 All @@ -193,6 +225,15 @@ sinks:
retry_max_duration_secs: 10
uri: "https://{{ .LogflareHost }}/logs?api_key={{ .ApiKey }}&source={{ .PostgrestSource }}"

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 @@ -11,6 +11,7 @@ if [ -f "${INIT_PAYLOAD_PATH:-}" ]; then
LOGFLARE_DB_SOURCE=$(jq -r '.["logflare_db_source"]' /etc/vector/init.json)
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_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 @@ -40,6 +41,7 @@ LOGFLARE_HOST=${LOGFLARE_HOST:-api.logflare.app}
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_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 @@ -48,3 +50,4 @@ sed -i "s|{{ .ApiKey }}|$LOGFLARE_API_KEY|g" $VECTOR_CONF
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|{{ .PitrErrorsSource }}|$LOGFLARE_PITR_ERRORS_SOURCE|g" $VECTOR_CONF

0 comments on commit 33b6636

Please sign in to comment.