Created
March 18, 2024 04:31
-
-
Save poundifdef/293bf2c4cd5aaa734b0b8e25ebf5309e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sources: | |
scratch_logs: | |
type: "journald" | |
include_units: ["scratchworker.service", "scratchdb.service"] | |
init_logs: | |
type: "journald" | |
include_units: ["init.scope"] | |
transforms: | |
scratch_transformed: | |
type: "remap" | |
inputs: ["scratch_logs"] | |
source: | | |
log, err = parse_json(.message) | |
# Check if the JSON parsing was successful | |
if is_object(log) { | |
# JSON is valid and parsed successfully, so assign it to 'log' | |
.log = log | |
} else { | |
# JSON is invalid, so assign the original string to 'log' | |
.log = .message | |
} | |
del(.message) | |
sinks: | |
scratch_motherduck: | |
type: "http" | |
method: "post" | |
uri: "https://scratch-v2.fly.dev/data?table=logs&api_key=x" | |
encoding: | |
codec: "json" | |
inputs: ["scratch_transformed", "init_logs"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment