OpenParable
Skip to content
← Back to skills

Rsyslog Module

Development
rsyslog_module

Rsyslog Module is an Agent Skill for development published in the rsyslog/rsyslog repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Encodes technical requirements for rsyslog modules, including concurrency, metadata, and initialization.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/rsyslog/rsyslog/blob/HEAD/.agent/skills/rsyslog_module/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/rsyslog-module, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

rsyslog_module

This skill captures the essential technical patterns for authoring and maintaining rsyslog modules (plugins/contrib).

Quick Start

  1. Locking: Follow the "Belt and Suspenders" rule (assert() + if).
  2. State: pData (shared) vs WID (per-worker).
  3. Boilerplate: Use BEGINmodInit, CODESTARTmodInit, etc.

Detailed Instructions

1. Concurrency & Locking

Rsyslog v8 has a high-concurrency worker model.

  • Shared State (pData): Mutable state shared across workers MUST be protected by a mutex in pData.
  • Per-Worker State (WID): Never share wrkrInstanceData_t.
  • Belt and Suspenders:
    assert(pData != NULL);
    if (pData == NULL) {
        // Handle error gracefully
    }
    
  • Headers: Every output module should have a "Concurrency & Locking" header block.

2. Module Lifecycle

Every module must implement and register standard entry points:

  • modInit(): Initialize static data and registry interfaces.
  • modExit(): Finalize and cleanup.
  • beginTransaction() / commitTransaction(): For efficient batch-based output.

3. Metadata Consistency

  • Location: MODULE_METADATA.yaml in the module directory.
  • Synchronization: Keep doc/ai/module_map.yaml in sync with locking and concurrency changes.

4. Build Configuration

  • Update plugins/Makefile.am and configure.ac when adding new modules.
  • Test Registration: Follow the "Define at Top, Distribute Unconditionally, Register Conditionally" pattern in tests/Makefile.am. See the rsyslog_test skill for details. This is critical for make distcheck validity.
  • Use MODULE_TYPE(eMOD_OUT) and other macros from runtime/module-template.h.

Related Skills

  • rsyslog_build: For compiling the module.
  • rsyslog_test: For creating module-specific smoke tests.
  • rsyslog_doc: For documentation requirements.