Stream logs from syslog

This commit is contained in:
nemunaire 2026-01-01 21:43:50 +07:00
commit f4481bca62
5 changed files with 287 additions and 5 deletions

View file

@ -11,6 +11,10 @@ func declareFlags(o *Config) {
flag.BoolVar(&o.UseARPDiscovery, "use-arp-discovery", true, "Use ARP table for device discovery instead of DHCP leases")
flag.StringVar(&o.DHCPLeasesPath, "dhcp-leases-path", "/var/lib/dhcp/dhcpd.leases", "Path to DHCP leases file")
flag.StringVar(&o.ARPTablePath, "arp-table-path", "/proc/net/arp", "Path to ARP table file")
flag.BoolVar(&o.SyslogEnabled, "syslog-enabled", false, "Enable syslog tailing for iwd messages")
flag.StringVar(&o.SyslogPath, "syslog-path", "/var/log/messages", "Path to syslog file")
flag.StringVar(&o.SyslogFilter, "syslog-filter", "daemon.info iwd:", "Filter string for syslog lines")
flag.StringVar(&o.SyslogSource, "syslog-source", "iwd", "Source name for syslog entries in logs")
}
// parseCLI parse the flags and treats extra args as configuration filename.

View file

@ -14,6 +14,10 @@ type Config struct {
UseARPDiscovery bool
DHCPLeasesPath string
ARPTablePath string
SyslogEnabled bool
SyslogPath string
SyslogFilter string
SyslogSource string
}
// ConsolidateConfig fills an Options struct by reading configuration from
@ -28,6 +32,10 @@ func ConsolidateConfig() (opts *Config, err error) {
UseARPDiscovery: true,
DHCPLeasesPath: "/var/lib/dhcp/dhcpd.leases",
ARPTablePath: "/proc/net/arp",
SyslogEnabled: false,
SyslogPath: "/var/log/messages",
SyslogFilter: "daemon.info iwd:",
SyslogSource: "iwd",
}
declareFlags(opts)