Skip to content

Commit

Permalink
stop infinite loop
Browse files Browse the repository at this point in the history
INSERT INTO _analytics is causing an infinite loop when logflare uses postgres as backend

PS: this is my first interaction with go ...
  • Loading branch information
dsl400 authored Dec 29, 2023
1 parent 2ddb04f commit 682545c
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions internal/start/templates/vector.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,18 @@ transforms:
inputs:
- router.db
source: |-
.metadata.host = "db-default"
.metadata.parsed.timestamp = .timestamp
.metadata.parsed.error_severity = replace!(.severity, r'^err$', "warning")
if .metadata.parsed.error_severity == "info" {
.metadata.parsed.error_severity = "log"
.message, err = to_string(.message)
if err != null {
log("Failed to convert .message to string: " + err, level: "error")
} else if !contains(.message, "_analytics") {
.metadata.host = "db-default"
.metadata.parsed.timestamp = .timestamp
.metadata.parsed.error_severity = replace!(.severity, r'^err$', "warning")
if .metadata.parsed.error_severity == "info" {
.metadata.parsed.error_severity = "log"
}
.metadata.parsed.error_severity = upcase(.metadata.parsed.error_severity)
}
.metadata.parsed.error_severity = upcase(.metadata.parsed.error_severity)
sinks:
logflare_auth:
type: "http"
Expand Down

0 comments on commit 682545c

Please sign in to comment.