Skip to content

About

Disk-backed Syslog relay for Splunk using Rsyslog + UF. Reference implementation, not a SC4S replacement. Use when on-disk persistence matters.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Syslog Relay for Splunk

A reference implementation of a disk-backed Syslog relay that receives logs from network devices, persists them on disk, and forwards them to Splunk via Universal Forwarder (UF).

Note: This project is intended as a reference implementation for teams that specifically need on-disk persistence before ingestion. It is not a drop-in replacement for Splunk Connect for Syslog (SC4S), and it is not positioned as a general-purpose syslog solution. See the comparison section for honest trade-offs.

🎯 What This Project Does

  • Disk-backed persistence: Logs are written to disk before being forwarded, so a Splunk outage or network interruption does not lose data.
  • Multi-device support: Works with FortiGate, Sophos, Cisco IOS, and any standard syslog sender.
  • Tuned Rsyslog: Configuration tuned for high-volume UDP 514 ingestion.
  • Log rotation and cleanup: Managed by logrotate with size- and time-based rotation, plus a cleanup script for old rotated files.
  • Resource control: UF is constrained using systemd cgroups.
  • Reduced duplicate ingestion: Tuned initCrcLength and whitelist to prevent UF from re-reading rotated files.

🏗️ Architecture

┌─────────────────┐     UDP 514      ┌──────────────────┐    TCP 9997    ┌─────────────────┐
│ Network Devices ├─────────────────►│  Rsyslog Relay   ├───────────────►│ Splunk Indexer  │
│ (FortiGate,     │                  │                  │                │                 │
│  Sophos, Cisco) │                  │ /var/log/remote/ │                │                 │
└─────────────────┘                  └──────────────────┘                └─────────────────┘
                                              │
                                              ▼
                                     ┌──────────────────┐
                                     │  Splunk UF       │
                                     │  (Monitors Disk) │
                                     └──────────────────┘

This is the classic Rsyslog + UF pattern, packaged with configuration, tuning notes, and operational scripts. The value of this repository is in the documented, reproducible configuration, not in a novel architecture.

🆚 Comparison with SC4S and Other Approaches

Splunk provides an official, open-source solution called Splunk Connect for Syslog (SC4S). SC4S is the recommended default for most syslog ingestion scenarios. This project differs in one specific dimension: on-disk persistence.

Dimension This Project (Rsyslog + UF) SC4S (HEC) Direct UF file monitoring
Transport Universal Forwarder (TCP 9997) HTTP Event Collector UF (TCP 9997)
Disk persistence before ingestion ✅ Yes ❌ No (by design) ✅ Yes (if writing to file first)
Behavior during Splunk outage Logs remain on disk; forwarded after recovery In-memory buffer; data loss possible Logs remain on disk; forwarded after recovery
Parsing Search time (props.conf) Ingest time (JSON transformation) Search time (props.conf)
Built-in device parsers ❌ None ✅ Hundreds ❌ None
Deployment model Manual Linux server setup Container (Docker/Kubernetes) Manual
Operational complexity Medium–high (Rsyslog, logrotate, UF, disk management) Low Low–medium

When to use this project

  • You have a hard requirement for on-disk durability before data reaches Splunk.
  • Your Splunk indexers or network may be unavailable for extended periods, and losing syslog data is unacceptable.
  • You want full control over Rsyslog, log rotation, and UF tuning, and you are comfortable managing a Linux server.
  • You are using this repository as a starting point to adapt to your environment, not as a turnkey product.

When not to use this project

  • You want a plug-and-play container with built-in parsers for many device types. Use SC4S.
  • You need encrypted syslog transport (TLS) out of the box. This project currently uses plaintext UDP 514; you would need to extend it with imtcp + gtls yourself.
  • You cannot dedicate operational effort to disk capacity planning, log rotation, and host maintenance.
  • You need vendor-supported software. This is a community reference implementation, not a supported product.

Honest trade-offs

  • Single point of failure: Rsyslog and UF run on the same host. If that host fails, both the buffer and the forwarding path are lost. High-availability setups would require additional design (e.g., redundant relay hosts, load balancing, or shared storage).
  • Disk capacity management: Persistence shifts the failure mode from "data loss" to "disk full." The included cleanup script handles rotated files, but you must monitor disk usage and size retention appropriately.
  • Plaintext transport: UDP 514 offers no encryption or authentication. This is unsuitable for environments with strict security requirements unless extended with TLS.
  • No built-in parsers: Unlike SC4S, this project does not ship device-specific parsing logic. Field extraction must be configured in Splunk props.conf/transforms.conf.

📋 Requirements

  • OS: Ubuntu 24.04 LTS (or any modern Linux distro with systemd).
  • CPU: 4 vCPU (recommended).
  • RAM: 8 GB (recommended).
  • Disk: 100+ GB (depends on log volume and retention).
  • Splunk: Indexer with UF receiving port enabled.

⚡ Quick Start

# 1. Clone the repository
git clone https://github.com/YOUR_USERNAME/syslog-relay.git
cd syslog-relay

# 2. Run the installation script
sudo chmod +x scripts/install.sh
sudo ./scripts/install.sh

# 3. Configure Splunk Indexer IP
sudo nano configs/splunk-uf/outputs.conf

# 4. Install Splunk UF (manual step)
# Follow: https://docs.splunk.com/Documentation/Forwarder

# 5. Send a test log
logger -n 127.0.0.1 -P 514 "Test log from syslog-relay"

📁 Directory Structure

syslog-relay/
├── configs/                    # Configuration files
│   ├── rsyslog/
│   │   ├── rsyslog.conf        # Main Rsyslog config
│   │   └── remote.conf         # Ruleset for remote logs
│   ├── logrotate/
│   │   ├── rsyslog-local       # Local system logs rotation
│   │   └── rsyslog-remote      # Remote logs rotation
│   ├── sysctl/
│   │   └── 99-rsyslog.conf     # Kernel tuning
│   ├── splunk-uf/
│   │   ├── inputs.conf         # UF inputs
│   │   ├── outputs.conf        # UF outputs (Splunk Indexer)
│   │   ├── limits.conf         # UF throughput
│   │   ├── server.conf         # UF parallel pipelines
│   │   └── SplunkForwarder.service.d_override.conf  # Cgroups limits
│   └── cron/
│       └── syslog-relay-cron   # Cron jobs
├── scripts/
│   ├── install.sh              # Automated installer
│   └── cleanup-old-logs.sh     # Old log cleanup script
├── docs/
│   ├── architecture.md         # Detailed architecture
│   ├── tuning.md               # Tuning guide
│   └── troubleshooting.md      # Troubleshooting guide
├── LICENSE                     # Apache 2.0
└── README.md                   # This file

⚙️ Configuration Files

All configuration files are located in the configs/ directory:

  • Rsyslog: configs/rsyslog/
  • Logrotate: configs/logrotate/
  • Sysctl: configs/sysctl/
  • Splunk UF: configs/splunk-uf/

🧹 Log Cleanup

A cleanup script removes old .gz and .log.1 files after 24 hours:

/usr/local/bin/cleanup-old-logs.sh

This script is run daily at 3 AM via cron. You must still monitor disk usage and adjust retention to your log volume.

🧪 Tested On

  • OS: Ubuntu 24.04 LTS (Server)
  • Rsyslog: v8.2312.0
  • Splunk Universal Forwarder: v10.x
  • Devices: FortiGate 200F, Sophos XGS 2300, Cisco IOS (Catalyst)

These are the environments where the configuration has been validated. Other distributions and device types may work but have not been tested.

🔒 Security and Operational Limitations

  • No TLS: This project uses UDP 514 (plaintext). For encrypted transport, you must extend it with TCP + TLS (imtcp + gtls). Do not deploy as-is in environments with strict security requirements.
  • Firewall: Ensure UDP 514 is only accessible from trusted network segments.
  • UF credentials: Never commit outputs.conf with real credentials. Use environment variables or a secrets manager.
  • Indexer IP: Replace <SPLUNK_INDEXER_IP> in outputs.conf with your actual Splunk Indexer IP address.
  • Single host: Rsyslog and UF share a host. Plan for host-level redundancy if high availability is required.
  • Disk exhaustion: Persistence means disk capacity is a critical operational concern. Monitor it.

📚 Documentation

🤝 Contributing

Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

📄 License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

About

Disk-backed Syslog relay for Splunk using Rsyslog + UF. Reference implementation, not a SC4S replacement. Use when on-disk persistence matters.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages