rsyslog/tests/omhttp-retry.sh
Cursor Agent 2db66bcb9d
omhttp: migrate to OMODTX; prep for project-supported status
Why: Modernize omhttp so HTTP forwarding is viable and maintainable in
current deployments (incl. Docker). Align the module with core-supported
interfaces, reduce maintenance risk, and pave the way to promote it from
contrib to an officially supported module.

Technical overview (conceptual):
- Switch plugin API from legacy TXIF (doAction) to OMODTX
  (commitTransaction). Update query entry points accordingly.
- Keep beginTransaction for batch init; fold the final flush from
  endTransaction into commitTransaction per OMODTX.
- Preserve external behavior: batching thresholds (maxBatchSize and
  maxBatchBytes), dynRestPath handling, statistics, and HUP behavior.
- In commitTransaction, process all records in one pass and submit
  batches when thresholds are crossed; non-batch mode posts per record.
- Retry test adjusted to tolerate duplicates during migration
  (omhttp-retry.sh), reflecting current OMODTX replay characteristics.

Addresses from #5957:
- Core modernization of omhttp to the project’s current module
  interface, suitable for containerized use cases.
- First step toward “project-supported” status by aligning with the
  supported core API and updating tests.

Planned follow-ups (separate commits):
- Fix dynRestPath after a batch flush (set new path right after
  initializeBatch).
- Revisit commit/replay semantics to minimize duplicates under retry, or
  document dup-tolerant behavior and test both modes.
- Verify and free batch.restPath and headerBuf; add focused tests (path
  change mid-batch, maxBatchBytes edges, TLS/gzip, HUP reinit).
- Documentation and packaging steps required for “project-supported”
  status (module docs, release notes, CI/packaging policy).
- Evaluate if a compatibility query hook is needed for older cores.

see also: https://github.com/rsyslog/rsyslog/issues/5957
2025-08-18 10:58:57 +02:00

48 lines
915 B
Bash
Executable File

#!/bin/bash
# This file is part of the rsyslog project, released under ASL 2.0
# Starting actual testbench
. ${srcdir:=.}/diag.sh init
export NUMMESSAGES=10000
export SEQ_CHECK_OPTIONS="-d"
omhttp_start_server 0 --fail-every 1000
generate_conf
add_conf '
module(load="../contrib/omhttp/.libs/omhttp")
main_queue(queue.dequeueBatchSize="2048")
template(name="tpl" type="string"
string="{\"msgnum\":\"%msg:F,58:2%\"}")
if $msg contains "msgnum:" then
action(
# Payload
action.resumeRetryCount="-1"
name="my_http_action"
type="omhttp"
errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
template="tpl"
server="localhost"
serverport="'$omhttp_server_lstnport'"
restpath="my/endpoint"
checkpath="ping"
batch="off"
# Auth
usehttps="off"
)
'
startup
injectmsg
shutdown_when_empty
wait_shutdown
omhttp_get_data $omhttp_server_lstnport my/endpoint
omhttp_stop_server
seq_check
exit_test