Přesměrování logů z Collectoru¶
LogMan.io Collector může přijaté logy přesměrovat do jiných systémů — další instance kolektoru, SIEM nebo nástroje s TCP/UDP. Vytvoříte pipeline, kde se logy přijmou, volitelně zpracují a přesměrují na více cílů.
Přehled¶
Přesměrování logů umožňuje:
- Replikovat logy na více cílů pro redundanci nebo compliance
- Přesměrovat logy na další kolektory v distribuovaném nasazení
- Odesílat logy do externích SIEM a nástrojů pro správu logů
- Vytvářet pipeline, kde logy procházejí více fázemi zpracování
Mechanismus přidá komponentu forward: do pipeline. Forward dostává události ze stejného výstupu jako vstup — lokální zpracování a vzdálené přesměrování současně.
Základní konfigurace přesměrování¶
Přesměrování TCP¶
Pro přesměrování logů přes TCP na jiný systém:
# Input receiving logs
input:TCP:TestTCPInput:
address: 0.0.0.0:9999
output: print1
# Forward logs to another system via TCP
forward:TCP:TestTCPForward:
address: 127.0.0.1:9998
output: print1
# Local output (optional)
output:Print:print1: {}
V tomto příkladu:
- Input (
input:TCP:TestTCPInput) přijímá logy na portu 9999 ze všech rozhraní (0.0.0.0) - Forward (
forward:TCP:TestTCPForward) přesměruje stejné logy na127.0.0.1:9998přes TCP - Output (
output:Print:print1) také zpracuje logy lokálně (výpis do konzole)
Forward a output používají stejné ID výstupu (print1) — oba dostávají události ze vstupu.
Přesměrování UDP¶
Pro přesměrování přes UDP:
# Input receiving logs
input:UDP:TestUDPInput:
address: 0.0.0.0:9999
output: print2
# Forward logs to another system via UDP
forward:UDP:TestUDPForward:
address: 127.0.0.1:9998
output: print2
# Local output (optional)
output:Print:print2: {}
Konfigurace je podobná TCP, ale používá UDP.
Parametry konfigurace forward¶
Adresa¶
Parametr address určuje cíl přesměrování logů:
forward:TCP:myforward:
address: <IP_ADDRESS>:<PORT>
output: <OUTPUT_ID>
- IP_ADDRESS: The destination IP address or hostname (IPv4 or IPv6 supported)
- PORT: The destination port number
Examples:
address: 192.168.1.100:514 # IPv4 address
address: [2001:db8::1]:514 # IPv6 address (use brackets)
address: collector.example.com:514 # Hostname
Reference výstupu¶
Parametr output musí odkazovat na stejné ID výstupu jako vstup:
input:TCP:myinput:
output: shared_output # Input uses this output
forward:TCP:myforward:
output: shared_output # Forward also uses the same output
output:Print:shared_output: {} # Local output definition
Forward a lokální výstup tak dostanou stejné události ze vstupu.
Přesměrování se smart classification¶
You can combine forwarding with smart classification to route logs based on source IP addresses, ports, and protocols. This is useful when you want to forward all classified logs to an external system while also processing them locally.
Example: Forwarding Classified Logs¶
This example shows how to use smart classification with forwarding for both UDP and TCP inputs:
classification:
smart_syslog: &smart_syslog # YAML anchor referencing to both SmartDatagram and SmartStream inputs
# All events are sent to stream 'generic'
generic:
- ip: "*"
# Listen on the UDP 514
input:SmartDatagram:UDP514:
address: 514
smart: *smart_syslog
output: smart-udp
forward:UDP:SmartUDPForward:
address: 127.0.0.1:9998
output: smart-udp
# Connection to LogMan.io
output:CommLink:smart-udp: {}
# Listen on the TCP 514
input:SmartStream:TCP514:
address: 514
smart: *smart_syslog
output: smart-tcp
forward:TCP:SmartTCPForward:
address: 127.0.0.1:9998
output: smart-tcp
# Connection to LogMan.io
output:CommLink:smart-tcp: {}
In this configuration:
-
Smart Classification: The
smart_syslogclassification map (defined with YAML anchor&smart_syslog) routes all incoming logs to thegenericstream based on source IP. -
UDP Input: Receives logs on UDP port 514, classifies them using the smart map, and sends them to output
smart-udp. -
UDP Forward: Forwards all UDP logs to
127.0.0.1:9998while also sending them to LogMan.io. -
TCP Input: Receives logs on TCP port 514, classifies them using the same smart map, and sends them to output
smart-tcp. -
TCP Forward: Forwards all TCP logs to
127.0.0.1:9998while also sending them to LogMan.io.
Both UDP and TCP inputs use the same smart classification map (via YAML anchor), but have separate output IDs (smart-udp and smart-tcp) to allow independent forwarding configurations.
Example: Advanced Classification with Forwarding¶
For more complex scenarios where you want to classify logs into different streams and forward them:
classification:
smart_forward: &smart_forward
# Classify logs from specific IP ranges
fortinet-fortigate-1:
- ip: "192.168.1.0/24"
port: "*"
protocol: UDP
linux-syslog-1:
- ip: "10.0.0.0/8"
port: "*"
protocol: TCP
# All other logs go to generic stream
generic:
- ip: "*"
port: "*"
protocol: "*"
# Connection to LogMan.io
connection:CommLink:commlink:
url: https://recv.logman.example.com/
# Input with smart classification
input:SmartDatagram:UDP514:
address: 514
smart: *smart_forward
output: smart_forward
# Forward all classified logs to external SIEM
forward:TCP:siem_forward:
address: siem.example.com:514
output: smart_forward
# Also send to local LogMan.io
output:CommLink:smart_forward: {}
Smart Classification and Forwarding
When using smart classification with forwarding, the forward component receives all logs from the smart classification output. The smart classification determines which stream logs belong to in LogMan.io, while the forward component sends all logs to the external destination. If you need to forward only specific log streams to different destinations, you can use separate inputs with different forward configurations, or use transform filters to create separate output paths.
Kompletní příklad: více cílů¶
Here is a complete example that receives logs, processes them locally, and forwards them to multiple destinations:
# Connection to LogMan.io
connection:CommLink:commlink:
url: https://recv.logman.example.com/
# Input receiving syslog
input:TCP:syslog_input:
address: 0.0.0.0:514
output: syslog_pipeline
# Forward to external SIEM system
forward:TCP:siem_forward:
address: siem.company.com:514
output: syslog_pipeline
# Forward to backup collector
forward:UDP:backup_collector:
address: 192.168.1.200:1514
output: syslog_pipeline
# Send to local LogMan.io
output:CommLink:syslog_pipeline: {}
In this configuration:
- Logs are received on TCP port 514
- Logs are forwarded to an external SIEM system via TCP
- Logs are also forwarded to a backup collector via UDP
- Logs are sent to the local LogMan.io instance via CommLink
All three destinations receive the same logs simultaneously.
Případy použití¶
1. Replikace logů pro compliance¶
Forward logs to a compliance archive system while also processing them in LogMan.io:
input:TCP:compliance_input:
address: 0.0.0.0:514
output: compliance_pipeline
# Forward to compliance archive
forward:TCP:compliance_archive:
address: archive.company.com:514
output: compliance_pipeline
# Process in LogMan.io
output:CommLink:compliance_pipeline: {}
2. Distribuované nasazení kolektorů¶
Forward logs from edge collectors to a central collector:
# Edge collector configuration
input:UDP:edge_input:
address: 0.0.0.0:514
output: edge_pipeline
# Forward to central collector
forward:TCP:central_collector:
address: central-collector.company.com:514
output: edge_pipeline
# Optional: also process locally
output:CommLink:edge_pipeline: {}
3. Integrace SIEM¶
Forward security logs to an external SIEM while maintaining local processing:
input:TCP:security_input:
address: 0.0.0.0:1514
output: security_pipeline
# Forward security events to SIEM
forward:TCP:siem_forward:
address: siem.company.com:514
output: security_pipeline
# Process in LogMan.io for correlation
output:CommLink:security_pipeline: {}
Řešení problémů¶
Verify Network Connectivity¶
Test if the collector can reach the forward destination:
# Test TCP connectivity
nc -v destination-ip destination-port
# Test UDP connectivity
nc -u -v destination-ip destination-port
Check Forward Configuration¶
Ensure that:
- The
outputparameter in the forward component matches the output ID used by the input - The destination address and port are correct
- Network firewall rules allow outbound connections to the destination
- The destination system is listening on the specified port
Monitor Forward Status¶
Check collector logs for forward-related errors:
# View collector logs
docker logs -f lmio-collector
# Look for forward connection errors
docker logs lmio-collector | grep -i forward
Common Issues¶
- Logs not reaching destination:
- Verify network connectivity between collector and destination
- Check firewall rules allow outbound connections
- Ensure destination is listening on the correct port
-
Verify the forward address format is correct
-
Connection refused errors:
- Destination may not be listening on the specified port
- Firewall may be blocking the connection
-
Check destination system logs
-
Partial log forwarding:
- UDP may drop packets if network is congested (consider TCP for reliability)
- Check if destination system has sufficient capacity
- Monitor collector resource usage
Doporučené postupy¶
- Use TCP for reliability: TCP ensures reliable delivery, while UDP is faster but may lose packets
- Monitor forward destinations: Set up monitoring to ensure forward destinations are available
- Use transforms for filtering: If you need to forward only specific logs, use transform filters
- Test connectivity: Verify network connectivity before deploying forward configurations
- Consider load balancing: For high-volume scenarios, consider forwarding to multiple destinations with load balancing