A lightweight syslog server implementation in Go that supports both TCP and UDP protocols. This server can filter messages based on IP addresses, severity levels, and content patterns.
- Supports both TCP and UDP syslog protocols
- Configurable message filtering:
- IP-based filtering with CIDR support
- Severity level filtering
- Content pattern exclusion
- Configurable output:
- File logging
- Console output
- YAML-based configuration
- Go 1.23 or higher
- Basic understanding of syslog protocol
- Clone the repository:
git clone https://github.com/yourusername/SimpleSyslogServer.git
cd SimpleSyslogServer- Build the server:
go build -o syslog-serverThe server is configured using config.yaml. Here's an example configuration:
server:
port: 514
log_file: "syslog.log" # Leave empty for no file logging
console_output: true # Set to false to disable console output
filter:
enabled: False # Set to false to disable all filtering
allowed_ips:
- "127.0.0.0/8" # Localhost range
- "192.168.0.0/24" # Local network
- "0.0.0.0/0" # All IPs
min_severity: 7 # 0=Emergency, 7=Debug
exclude_patterns:
- "test"
- "debug"port: The port number to listen on (default: 514)log_file: Path to the log file (empty for no file logging)console_output: Enable/disable console output
enabled: Enable/disable all filteringallowed_ips: List of allowed IP addresses/ranges in CIDR notationmin_severity: Minimum severity level to accept (0-7)- 0: Emergency
- 1: Alert
- 2: Critical
- 3: Error
- 4: Warning
- 5: Notice
- 6: Informational
- 7: Debug
exclude_patterns: List of patterns to exclude from logging
- Start the server:
./syslog-server- Configure your syslog clients to send logs to the server:
# Example using logger command
logger -n localhost -P 514 "Test message"You can test the server using the logger command or any syslog client:
# Test UDP
logger -n localhost -P 514 -d "Test UDP message"
# Test TCP
logger -n localhost -P 514 -T "Test TCP message"This project is licensed under the terms of the included LICENSE file.
Contributions are welcome! Please feel free to submit a Pull Request.