OpenBSD Handbook

    Theme
    • Part I. Install & Configure
      • Introduction to OpenBSD
      • Installing OpenBSD
      • The X Window System
      • Networking on OpenBSD
      • System Configuration
      • OpenBSD Basics
      • Managing Software: Packages and Ports
    • Part II. Daily Operations
      • OpenBSD Desktop Environments
      • Multimedia
      • Printing
      • Linux Compatibility
      • Windows Compatibility
      • Games
    • Part III. System Administration
      • Virtualization
      • Storage and File Systems
      • Updating and Upgrading
      • Localization
      • The OpenBSD Boot Process
      • Security
    • Part IV. Networking & Daemons
      • Services
        • Database
          • MariaDB
          • PostgreSQL
          • Redis
          • memcached
        • Directory
          • YP (NIS)
          • LDAP
        • File
          • NFS
          • Samba
        • FTP Services
          • ftpd
          • ProFTPD
          • vsftpd
          • Pure-FTPd
          • TFTP
        • Mail
          • OpenSMTPD Mail Server
          • Dovecot IMAP and POP3 Server
          • Postfix
          • Exim
          • Rspamd
        • Name
          • Unbound DNS Resolver
          • NSD Authoritative DNS Server
          • BIND DNS Server
        • Networking
          • OpenBGPD
          • rad
          • DHCP on OpenBSD
          • slaacd
        • Web
          • Apache HTTP Server
          • nginx Web Server
          • OpenBSD httpd Web Server
          • relayd Reverse Proxy
        • Logging
          • syslogd
        • Monitoring
          • SNMP
        • Remote Access
          • Audit OpenSSH
          • OpenSSH Server
        • File Synchronization
          • rsync
        • Messaging
          • RabbitMQ Message Broker
        • Time
          • NTP Time Synchronization
        • Load Balancing
          • Build Redundant Load-Balanced Gateways
          • Load Balance Services with NAT or DSR
          • Build an HA HTTPS Load Balancer
      • PF
        • pfctl cheat sheet
        • PF Anchors
        • PF Filter Rules
        • PF Forwarding
        • PF Lists and Macros
        • PF Load Balancing
        • PF Logging
        • PF NAT
        • PF Options
        • PF Policies
        • PF Shortcuts
        • PF Tables
      • Advanced Networking
        • High Availability and State Replication
        • Multi-WAN and Policy-Based Routing
        • VPN and Cryptographic Tunneling
        • Classic and Lightweight Tunnels
        • IPv6 at Scale
        • QoS and Traffic Shaping
        • MPLS and Label Distribution
        • Network Services at Scale
        • Virtualization and Host Networking
        • Large-Scale L2 and L3 Design
        • Telemetry, Logging, and Flow Export
        • Hardening and Operational Safety
        • Reference Architectures
        • Troubleshooting Playbooks
      • Serial Communication
    • Part V. Miscellaneous
      • Virtualization Cheat Sheet
      • OpenBSD Cheatsheet
      • How-to Guides
        • Installation and First Boot
          • Complete the First 30 Minutes After Installation
          • Check Hardware Compatibility Before Installing
          • Bootstrap Wi-Fi Firmware Without Ethernet
          • Run OpenBSD as a Virtual Machine Guest
          • Install OpenBSD on a VPS or Cloud Server
          • Install OpenBSD with Full-Disk Encryption
          • Dual-Boot OpenBSD on a UEFI System
          • Automate OpenBSD Installation with Autoinstall and PXE
        • Desktops and Laptops
          • Set Up OpenBSD as a Laptop or Workstation
          • Configure Laptop Power Management
          • Troubleshoot Web Browsers on OpenBSD
          • Use Plan 9 Tools on OpenBSD
          • Build a Minimal Desktop with suckless Tools
          • Install Z shell (zsh)
        • Networking and Remote Access
          • Create an Administrator Account with doas and SSH Keys
          • Configure Secure Remote Access with OpenSSH
          • Use FIDO Security Keys with OpenSSH
          • Configure Wi-Fi Roaming and Wired Failover
          • Troubleshoot PF, NAT, and Routing
          • Route Multiple VLANs with PF
          • Configure a Road-Warrior WireGuard VPN
          • Route IPv6 Networks without NAT
          • Test OpenBGPD with Two Providers
          • Unlock an Internal Service with an SSH Key
          • Build a Simple Router and Firewall
        • Servers and Services
          • Set Up WordPress on OpenBSD
          • Build a Mail Server with OpenSMTPD, Dovecot, and Rspamd
        • Security, Maintenance and Recovery
          • Establish a Conservative Security Baseline
          • Recover Access and Reset the Root Password
          • Collect OpenBSD Diagnostic Evidence
          • Troubleshoot Package Installation and Update Failures
          • Schedule Recurring Maintenance
          • Monitor an OpenBSD System
          • Back Up and Restore an OpenBSD System
          • Configure softraid RAID1
          • Recover an OpenBSD System That Does Not Boot
        • Building, Automation and Virtual Machines
          • Manage OpenBSD with Ansible
          • Build Third-Party Software from Ports
          • Build OpenBSD from Source
          • Plan a Docker Workload Migration to OpenBSD
      • OpenBSD for Linux Users
      • OpenBSD for FreeBSD Users
      • OpenBSD for macOS Users
    • OpenBSD FAQ
    • OpenBSD Architectures
      • OpenBSD Package Search
        • Synopsis
        • Default Operation
        • Configuration: /etc/syslog.conf
          • Facilities and Levels
        • Remote Logging
          • Accepting Remote Logs
        • Runtime Control
        • Viewing and Managing Logs
        • Log Rotation and Retention
        • Troubleshooting

        syslogd

        Synopsis #

        The syslogd(8) daemon is responsible for collecting and distributing log messages from the OpenBSD system and its services. It listens for log entries from the kernel and user processes via the syslog(3) interface and routes them according to rules defined in the configuration file /etc/syslog.conf.

        By default, syslogd writes messages to text files in /var/log/. It can also forward messages to remote log hosts using UDP or TLS-encrypted TCP. On OpenBSD, syslogd runs with strict privilege separation and filesystem access constraints and is enabled by default.

        The examples below configure local log destinations, remote forwarding, reception, and rotation.

        Default Operation #

        When OpenBSD boots, syslogd is started automatically. It reads its configuration from /etc/syslog.conf and begins listening for local log messages over the Unix domain socket /dev/log.

        Log files are rotated periodically by newsyslog(8) according to settings in /etc/newsyslog.conf.

        To confirm that syslogd is running:

        ps -aux | grep syslogd
        

        To check its status via rcctl(8):

        doas rcctl check syslogd
        

        Configuration: /etc/syslog.conf #

        The /etc/syslog.conf file defines which messages are written where. Each line consists of a selector (facility.level) and an action. For example:

        auth.info               /var/log/authlog
        cron.*                  /var/log/cron
        mail.err                /dev/console
        *.notice;auth,authpriv.none  /var/log/messages
        

        This configuration performs the following:

        • Writes authentication logs at info level or higher to /var/log/authlog
        • Logs all cron messages to /var/log/cron
        • Sends mail errors to the console
        • Logs all other notices except those from auth and authpriv to /var/log/messages

        To apply changes:

        doas sh -c 'kill -HUP "$(cat /var/run/syslog.pid)"'
        

        Facilities and Levels #

        Facilities group related services (e.g., auth, cron, mail). Levels indicate severity, from most critical to least:

        • emerg – system is unusable
        • alert – action must be taken immediately
        • crit – critical condition
        • err – error condition
        • warning – warning
        • notice – normal but significant
        • info – informational
        • debug – debug-level messages

        The special level none can be used to exclude a facility.

        Remote Logging #

        To forward logs to a remote syslog server, add a line such as the following to /etc/syslog.conf:

        *.*    @loghost.example.net
        

        For TLS-encrypted logging, use the tls prefix:

        *.*    @tls://loghost.example.net
        

        Then restart syslogd:

        doas rcctl restart syslogd
        

        Remote logging requires DNS resolution and network access. Check the rules in pf.conf allow this traffic if packet filtering is enabled.

        Accepting Remote Logs #

        To allow incoming logs from other hosts, add the -u or -U flags to syslogd via rcctl:

        doas rcctl set syslogd flags -u
        doas rcctl restart syslogd
        

        The -u flag enables unencrypted UDP reception. For encrypted TCP logging (TLS), use -S listen_address and configure the certificate and key named for the first listener address as described in syslogd(8). -T host:port enables unencrypted TCP, not TLS.

        Runtime Control #

        To disable syslogd, for example in a chrooted or isolated environment:

        doas rcctl disable syslogd
        doas rcctl stop syslogd
        

        To re-enable it later:

        doas rcctl enable syslogd
        doas rcctl start syslogd
        

        Viewing and Managing Logs #

        Most log files are stored under /var/log/. Common files include:

        • /var/log/messages — general system activity
        • /var/log/authlog — authentication events
        • /var/log/daemon — messages from long-running services
        • /var/log/cron — scheduled task output
        • /var/log/maillog — mail subsystem messages

        To follow log output in real time:

        doas tail -f /var/log/messages
        

        Log Rotation and Retention #

        Log rotation is handled by newsyslog(8), which is normally invoked hourly by cron. The configuration file /etc/newsyslog.conf defines which logs are rotated, how many archives to keep, and when to compress them.

        A typical entry:

        /var/log/messages     600  5     100  *     Z
        

        This retains five compressed archives of /var/log/messages, rotating the log once it exceeds 100 KB.

        Troubleshooting #

        If log files are empty or missing:

        • Ensure that syslogd is running
        • Confirm that pf(4) is not blocking outbound or inbound syslog traffic
        • Verify that relevant selectors exist in /etc/syslog.conf
        • Create newly configured log files with appropriate ownership and permissions before reloading; syslogd does not create missing files
        • Check there is enough disk space under /var

        To test whether log messages are reaching the daemon:

        logger -p user.notice "This is a test log entry"
        

        Then inspect the appropriate log file (such as /var/log/messages) for the test entry.

        Report a bug
        • Synopsis
        • Default Operation
        • Configuration: /etc/syslog.conf
          • Facilities and Levels
        • Remote Logging
          • Accepting Remote Logs
        • Runtime Control
        • Viewing and Managing Logs
        • Log Rotation and Retention
        • Troubleshooting