mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-13 04:50:41 +01:00
This commit adds the initial implementation of the `mmaitag` module, a pluggable AI-based message classification processor. The module supports two providers: - `gemini`: uses the Gemini API via libcurl and JSON-C - `gemini_mock`: a deterministic in-memory mock used for testing Each log message is classified individually and tagged with a label stored in a configurable message variable (default: `$.aitag`). Included: - Provider abstraction layer (`ai_provider.h`) - Gemini provider with API key support (inline or via file) - Prompt customization and input property selection - Two regression tests: basic and invalid-key scenarios - Sphinx documentation under `doc/configuration/modules` Note: mmaitag is in its infancy and primarily a PoC. Future work will improve batching, performance, and add more providers. Refs: - https://github.com/rsyslog/rsyslog/issues/5747 (AI-first strategy) With the help of AI Agents: Codex, Gemini
24 lines
649 B
Bash
Executable File
24 lines
649 B
Bash
Executable File
#!/bin/bash
|
|
## test gemini provider with invalid API key
|
|
. ${srcdir:=.}/diag.sh init
|
|
|
|
generate_conf
|
|
add_conf '
|
|
module(load="../plugins/mmaitag/.libs/mmaitag")
|
|
module(load="../plugins/imtcp/.libs/imtcp")
|
|
input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port")
|
|
|
|
template(name="outfmt" type="string" string="%msg% [%$.aitag%]\n")
|
|
|
|
if($msg contains "msgnum:00") then {
|
|
action(type="mmaitag" provider="gemini" apikey="dummy")
|
|
}
|
|
action(type="omfile" file="'$RSYSLOG_OUT_LOG'" template="outfmt")
|
|
'
|
|
startup
|
|
tcpflood -m 1
|
|
shutdown_when_empty
|
|
wait_shutdown
|
|
content_check "request for a message failed" "$RSYSLOG_OUT_LOG"
|
|
exit_test
|