# microsoft/oms-auditd-plugin architecture

> Architecture diagram of the GitHub repository microsoft/oms-auditd-plugin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/microsoft/oms-auditd-plugin
- Repository: https://github.com/microsoft/oms-auditd-plugin

## Overview

##### Main Components

a) Core Components:
- Linux Audit Daemon (auditd) - External System
- AUOMS Plugin Core (central component)
- OMS Agent - External System
- Event Processing Pipeline

b) Key Processing Components:
- Event Readers (RawEventReader, StdinReader)
- Event Writers (AbstractEventWriter, FluentEventWriter, OMSEventWriter, SyslogEventWriter)
- Event Processing Components (RawEventProcessor, EventAggregator, EventPrioritizer)
- Filtering System (EventFilter, FiltersEngine, ProcFilter)

**[Input Layer]**
- Audit System Interface
- Raw Event Collection
- Unix Domain Listeners

**[Processing Layer]**
- Event Processing Pipeline
- Filtering Engine
- Aggregation System
- Priority Queue System

**[Output Layer]**
- Multiple Writer Implementations
- Output Formatting
- Delivery Mechanisms

##### Important Elements to Highlight

a) Data Flow Paths:
- Configuration and monitoring paths

b) Key Components:
- Event Queue System (SPSCDataQueue)
- Configuration Management
- Monitoring & Metrics System
- Process Tree Management

##### Implementation Details to Note

- Relationship between the various EventWriter implementations
- Plugin's integration points with auditd
- Where metrics and operational status monitoring occur
- Configuration reload paths

##### Specific Technical Elements

Technical components in appropriate sections:
- CGroups integration
- Netlink communication
- Unix Domain Socket interfaces
- Process monitoring capabilities

This design should emphasize the plugin's role as a critical security component while showing its efficient event processing capabilities and reliable delivery mechanisms.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        AD[Linux Audit Daemon]:::external
        UDL["Unix Domain Listeners"]:::input
        click UDL "https://github.com/microsoft/oms-auditd-plugin/blob/master/UnixDomainListener.cpp"
        REC["Raw Event Collection"]:::input
        click REC "https://github.com/microsoft/oms-auditd-plugin/blob/master/RawEventReader.h"
        STD["Stdin Reader"]:::input
        click STD "https://github.com/microsoft/oms-auditd-plugin/blob/master/StdinReader.cpp"
    end

    subgraph Processing
        direction TB
        EPP["Event Processing Pipeline"]:::processing
        click EPP "https://github.com/microsoft/oms-auditd-plugin/blob/master/RawEventProcessor.cpp"
        
        subgraph Filtering
            FE["Filters Engine"]:::security
            click FE "https://github.com/microsoft/oms-auditd-plugin/blob/master/FiltersEngine.cpp"
            EF["Event Filter"]:::security
            click EF "https://github.com/microsoft/oms-auditd-plugin/blob/master/EventFilter.cpp"
            PF["Process Filter"]:::security
            click PF "https://github.com/microsoft/oms-auditd-plugin/blob/master/ProcFilter.cpp"
        end
        
        subgraph EventHandling
            EA["Event Aggregator"]:::processing
            click EA "https://github.com/microsoft/oms-auditd-plugin/blob/master/EventAggregator.cpp"
            EP["Event Prioritizer"]:::processing
            click EP "https://github.com/microsoft/oms-auditd-plugin/blob/master/EventPrioritizer.cpp"
            PQ["Priority Queue"]:::queue
            click PQ "https://github.com/microsoft/oms-auditd-plugin/blob/master/PriorityQueue.cpp"
            SPSC["SPSC Data Queue"]:::queue
            click SPSC "https://github.com/microsoft/oms-auditd-plugin/blob/master/SPSCDataQueue.cpp"
        end
        
        subgraph Security
            ARM["Audit Rules Monitor"]:::security
            click ARM "https://github.com/microsoft/oms-auditd-plugin/blob/master/AuditRulesMonitor.cpp"
            CR["Command Redactor"]:::security
            click CR "https://github.com/microsoft/oms-auditd-plugin/blob/master/CmdlineRedactor.cpp"
            SEL["SELinux Policy"]:::security
            click SEL "https://github.com/microsoft/oms-auditd-plugin/blob/master/installer/selinux/auoms.te"
        end
        
        subgraph Performance
            CPU["CPU Limits"]:::performance
            click CPU "https://github.com/microsoft/oms-auditd-plugin/blob/master/CPULimits.cpp"
            Cache["Caching System"]:::performance
            click Cache "https://github.com/microsoft/oms-auditd-plugin/blob/master/Cache.h"
        end
        
        subgraph Monitoring
            CM["Collection Monitor"]:::monitoring
            click CM "https://github.com/microsoft/oms-auditd-plugin/blob/master/CollectionMonitor.cpp"
            SM["System Metrics"]:::monitoring
            click SM "https://github.com/microsoft/oms-auditd-plugin/blob/master/SystemMetrics.cpp"
            PM["Process Metrics"]:::monitoring
            click PM "https://github.com/microsoft/oms-auditd-plugin/blob/master/ProcMetrics.cpp"
        end
    end

    subgraph Output
        AEW["Abstract Event Writer"]:::output
        click AEW "https://github.com/microsoft/oms-auditd-plugin/blob/master/AbstractEventWriter.cpp"
        FEW["Fluent Event Writer"]:::output
        click FEW "https://github.com/microsoft/oms-auditd-plugin/blob/master/FluentEventWriter.cpp"
        OEW["OMS Event Writer"]:::output
        click OEW "https://github.com/microsoft/oms-auditd-plugin/blob/master/OMSEventWriter.cpp"
        SEW["Syslog Event Writer"]:::output
        click SEW "https://github.com/microsoft/oms-auditd-plugin/blob/master/SyslogEventWriter.cpp"
        UDW["Unix Domain Writer"]:::output
        click UDW "https://github.com/microsoft/oms-auditd-plugin/blob/master/UnixDomainWriter.cpp"
    end

    subgraph Configuration
        Config["Configuration Manager"]:::config
        click Config "https://github.com/microsoft/oms-auditd-plugin/blob/master/Config.cpp"
        EWC["Event Writer Config"]:::config
        click EWC "https://github.com/microsoft/oms-auditd-plugin/blob/master/EventWriterConfig.cpp"
        MC["Main Config"]:::config
        click MC "https://github.com/microsoft/oms-auditd-plugin/blob/master/installer/conf/auoms.conf"
        OC["Output Config"]:::config
        click OC "https://github.com/microsoft/oms-auditd-plugin/blob/master/installer/conf/example_output.conf"
        RC["Redaction Config"]:::config
        click RC "https://github.com/microsoft/oms-auditd-plugin/blob/master/installer/conf/example_redact.conf"
    end

    AD --> UDL
    AD --> REC
    AD --> STD
    
    UDL --> EPP
    REC --> EPP
    STD --> EPP
    
    EPP --> FE
    FE --> EF
    FE --> PF
    
    EPP --> EA
    EA --> EP
    EP --> PQ
    PQ --> SPSC
    
    SPSC --> AEW
    AEW --> FEW
    AEW --> OEW
    AEW --> SEW
    AEW --> UDW
    
    Config --> EPP
    EWC --> AEW
    
    ARM --> EPP
    CR --> EPP
    SEL --> EPP
    
    CPU --> EPP
    Cache --> EPP
    
    CM --> EPP
    SM --> EPP
    PM --> EPP

    classDef external fill:#f96,stroke:#333
    classDef input fill:#9f6,stroke:#333
    classDef processing fill:#69f,stroke:#333
    classDef security fill:#f66,stroke:#333
    classDef performance fill:#ff9,stroke:#333
    classDef monitoring fill:#c9f,stroke:#333
    classDef output fill:#9cf,stroke:#333
    classDef queue fill:#fc9,stroke:#333
    classDef config fill:#ccc,stroke:#333
```
