Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge branch 'develop' into bma/docker-aio-no-pgbouncer
  • Loading branch information
bmpandrade authored Mar 22, 2024
commit 33b6636021bc7cd210704dd4dc3972618e46b091
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New line here 😛

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😱 need to update my formatters to do it automatically 🤖

You are viewing a condensed version of this merge commit. You can view the full changes here.