Skip to content

Instantly share code, notes, and snippets.

@radu-gheorghe
Created October 20, 2025 12:13
Show Gist options
  • Save radu-gheorghe/34a9d255645f44b2f864bb16c71d3b6c to your computer and use it in GitHub Desktop.
Save radu-gheorghe/34a9d255645f44b2f864bb16c71d3b6c to your computer and use it in GitHub Desktop.
write to Vespa via rsyslog's http output (omhttp)
# TODO inputs go here
module(load="omhttp")
# template that outputs the message field in a JSON document
# -> go wild and make your own documents
# -> make sure you have the "fields" object on top
# -> see https://docs.vespa.ai/en/document-v1-api-guide.html
template(name="json-message" type="list" option.json="on") {
constant(value="{ \"fields\": { \"message\": \"")
property(name="msg")
constant(value="\" }}")
}
# template that outputs Vespa path + random doc ID
# -> fill in NAMESPACE and DOCTYPE. These can also be dynamic
template(name="vespaDocUrl" type="string"
string="/document/v1/NAMESPACE/DOCTYPE/docid/%uuid%"
)
# writing to Vespa. You can have retries, define what to do on retries, etc.
# -> more info at https://www.rsyslog.com/doc/configuration/modules/omhttp.html
action(type="omhttp"
# Vespa host and port
server="vespa"
serverport="8080"
# for secure endpoints (e.g., Vespa Cloud), you can provide certs and all
useHttps="off"
# no batching, but maybe HTTP/2 in the future
# -> see https://blog.vespa.ai/http2
batch="off"
# point to the template that outputs random doc ID
dynrestpath="on"
restpath="vespaDocUrl"
# template making JSON documents to send to Vespa
template="json-message"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment