← Back to Articles
Security Monitoring • DFIR

High-Throughput Linux Audit Logging with Vector & ClickHouse DFIR Pipeline

High-Throughput Linux Audit Logging with Vector & ClickHouse DFIR Pipeline
High-Throughput Auditd Telemetry Pipeline with Vector & ClickHouse
Executive Summary & Key Security Takeaways
  • High-Throughput Log Forwarding: Ingest 100,000+ audit events/sec using Vector written in Rust.
  • Columnar Storage Efficiency: Compress security audit logs by 10x using ClickHouse columnar database storage.
  • Real-Time DFIR Queries: Execute SQL analytical queries over billions of kernel process events in sub-seconds.
  • Zero Log Loss Architecture: Utilize Vector disk-backed memory buffers to survive network outages.

1. Vector Rust Forwarder vs Traditional Syslog/Filebeat

High-volume Linux server fleets generate gigabytes of auditd events per hour. Legacy log forwarders (rsyslog, Logstash) consume excessive RAM and CPU cycles under heavy kernel syscall tracing, causing log drop under peak loads.

Vector is an ultra-fast, memory-safe log forwarder written in Rust. By utilizing async I/O and zero-copy parsing, Vector processes audit events with minimal CPU overhead.

Vector streams auditd logs directly from /var/log/audit/audit.log, parses raw key-value pairs into structured JSON payloads, and batches writes to ClickHouse.

Using Vector's VRL (Vector Remap Language), security teams enrich raw audit records with host metadata before transmission.

Vector handles high-concurrency log streams seamlessly without triggering backpressure stalls.

Native Rust memory safety guarantees prevent memory leaks during prolonged high-volume logging events.

Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.

Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.

Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.

Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.

# Vector Configuration (/etc/vector/vector.yaml)
sources:
  linux_audit:
    type: file
    include:
      - /var/log/audit/audit.log
    ignore_checkpoints: false

transforms:
  parse_audit:
    type: remap
    inputs:
      - linux_audit
    source: |
      . = parse_key_value!(.message)
      .timestamp = parse_timestamp!(.msg, "%s.%3f") ?? now()

sinks:
  clickhouse_dfir:
    type: clickhouse
    inputs:
      - parse_audit
    endpoint: http://127.0.0.1:8123
    database: security_logs
    table: audit_events
    skip_unknown_fields: true

2. ClickHouse Columnar Schema for DFIR Forensics

ClickHouse stores audit data column-by-column rather than row-by-row, enabling massive compression ratios (ZSTD) and rapid aggregation across billions of security events.

Define MergeTree tables indexed by event timestamp and process executable path for instant query execution during incident response investigations.

Configuring TTL policies automatically purges or archives cold audit logs after 90 days, optimizing disk storage.

ClickHouse vector engines execute analytical aggregations directly in CPU L1/L2 caches for ultra-fast query speeds.

Column-level dictionary encoding compresses repeated process execution paths efficiently.

Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.

Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.

Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.

Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.

-- ClickHouse Audit Events Table Schema
CREATE DATABASE IF NOT EXISTS security_logs;

CREATE TABLE IF NOT EXISTS security_logs.audit_events (
    timestamp DateTime64(3, 'UTC'),
    type LowCardinality(String),
    pid UInt32,
    uid UInt32,
    exe String,
    key LowCardinality(String),
    success UInt8
)
ENGINE = MergeTree()
ORDER BY (timestamp, type, exe)
TTL timestamp + INTERVAL 90 DAY;

3. Executing Sub-Second Forensics SQL Queries

DFIR analysts query ClickHouse using standard SQL to investigate unauthorized binary executions or privilege escalation events across thousands of servers.

Sub-second execution speeds allow incident response teams to trace lateral movement during live security incidents.

Complex JOIN queries allow security operations centers to correlate process executions with network connection events.

Exporting query results to CSV or JSON formats facilitates forensic evidence preservation for security reports.

Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.

Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.

Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.

Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.

-- Query Top 10 Executed Commands by Non-Root Users
SELECT 
    exe, 
    count()
AS executions 
FROM security_logs.audit_events 
WHERE uid != 0 AND type = 'EXECVE' AND timestamp >= now() - INTERVAL 1 HOUR
GROUP BY exe 
ORDER BY executions DESC 
LIMIT 10;

4. Verification & Telemetry Audit Checklist

Verify Vector pipeline throughput metrics and monitor ClickHouse table insertion rates.

Audit disk buffer queues to ensure zero log loss during database maintenance windows.

Set up Prometheus alerts for Vector buffer queue growth to detect database connectivity issues early.

Regular benchmark tests confirm that ClickHouse maintains sub-second query speeds under continuous log ingestion.

Implementing automated continuous monitoring across production nodes ensures that compliance policies remain enforced during infrastructure updates.

Regular security audits should be integrated into DevOps CI/CD pipelines to verify that system configurations conform to zero-trust architecture standards.

Documenting system architecture and access control rules facilitates compliance verification during independent third-party security audits.

Enforcing strict runtime isolation boundaries prevents privilege escalation vectors across multi-tenant cloud environments.

# Inspect Vector top processing stats
vector top

# Audit ClickHouse table disk usage and row count
clickhouse-client --query "SELECT count(), formatReadableSize(sum(data_compressed_bytes)) FROM system.parts WHERE table = 'audit_events'"

Frequently Asked Questions (FAQ)

Why use ClickHouse over Elasticsearch for DFIR log storage?

ClickHouse provides 5x-10x higher log compression rates and significantly faster analytical aggregation queries with much lower RAM requirements.

How does Vector prevent log loss during ClickHouse server downtime?

Vector maintains disk-backed buffer queues on the local filesystem, storing incoming events until the ClickHouse endpoint recovers.

Zyekh Abdul Qadir Jailani

Written by Zyekh Abdul Qadir Jailani

Digital Forensics & Incident Response (DFIR) Specialist & Security Researcher specializing in Linux kernel hardening, threat hunting, and system security research.

Utility Security Tools Related to this Article:

Gunakan SQL Query Formatter dan Unix Epoch Converter untuk membantu alur kerja konfigurasi keamanan Anda secara privasi di browser.