Configuring Firewall Logging: Correctly Setting Up Logging for SRV1 and SRV2

Abstract: Configure BIND on SRV1 to forward DNS query logs to SRV2 via syslog for centralized tracking.

Created: 2026-09-16 by
Configuring firewall logging requires distinguishing between network packet filtering logs and application-level DNS logs. This guide clarifies the correct procedure for setting up BIND DNS logging on SRV1 to forward logs to SRV2, addressing the specific requirement for DNS query tracking rather than generic firewall packet inspection.

Distinguishing Firewall Logs from DNS Logs

It is crucial to understand that standard firewall logging (such as iptables or nftables) records packet headers like source IP, destination IP, and protocol. In contrast, BIND (Berkeley Internet Name Domain) logs record DNS-specific events, such as zone transfers, queries, and updates. The original request specifically asks for BIND logs on SRV1 to be sent to SRV2. This is not a firewall configuration task in the traditional sense of blocking traffic, but rather a logging infrastructure setup for DNS services.

If you are looking to log dropped packets at the network level, you should refer to our guide on Block MAC Address with Iptables During Attack. However, for this article, we focus exclusively on configuring the BIND daemon to generate detailed logs and forwarding them via syslog to a central server.

Prerequisites and Network Configuration

Before modifying configuration files, ensure that both SRV1 (the DNS server generating logs) and SRV2 (the log receiver) are properly configured on your network. You must verify that:

  • Syslog Service is Active: Both servers must have a syslog daemon running (e.g., rsyslog, syslog-ng, or systemd-journald).
  • Network Connectivity: SRV1 must be able to reach SRV2 over UDP port 514 (standard syslog) or TCP port 514/6514 if TLS is enabled. Test this with nc -zv SRV2_IP 514.
  • BIND Installation: Ensure BIND is installed on SRV1. You can check this by running named -v.

If you need to secure the connection between these servers, consider implementing SSH tunneling or using a dedicated logging agent like Fluent Bit, though standard syslog is sufficient for basic setups.

Configuring BIND Logging on SRV1

The first step is to configure BIND on SRV1 to output logs to a file or directly to the system logger. Modern BIND versions often default to logging to /var/log/named.log or via the system journal. To ensure compatibility with SRV2, we will configure BIND to use the syslog facility.

Edit the main BIND configuration file, typically located at /etc/named.conf or /etc/bind/named.conf. Add or modify the logging section as follows:

logging {
    channel syslog_debug {
        syslog local2;
        severity debug;
    };

    category default {
        syslog_debug;
    };

    category queries {
        syslog_debug;
    };
};

In this configuration:

  • channel syslog_debug: Defines a custom channel that sends logs to the local2 syslog facility. Using a local facility (like local0 through local7) prevents DNS logs from mixing with other system messages.
  • severity debug: Sets the logging level to debug. For production, you might prefer info or warning to reduce noise, but debug ensures all queries are captured for troubleshooting.
  • category queries: Ensures that DNS query logs are sent to this channel. This is the most critical part for monitoring who is querying your DNS server.

After editing, test the configuration syntax with named-checkconf. If no errors are reported, restart the BIND service using systemctl restart named (or systemctl restart bind9 depending on your distribution).

Configuring Syslog Forwarding to SRV2

Now that SRV1 is generating logs on the local2 facility, you must configure the syslog daemon on SRV1 to forward these specific logs to SRV2. We assume rsyslog is used here, as it is the most common implementation.

Edit the rsyslog configuration file, usually /etc/rsyslog.conf or a file in /etc/rsyslog.d/. Add the following line to forward local2 logs to SRV2:

local2.* @@SRV2_IP:514

Key points about this directive:

  • local2.*: Selects all severity levels for the local2 facility.
  • @@: Indicates TCP forwarding. Use @ for UDP. TCP is recommended for reliability to prevent log loss during network congestion.
  • SRV2_IP:514: Replace SRV2_IP with the actual IP address of SRV2.

Restart the rsyslog service on SRV1 with systemctl restart rsyslog.

Verifying Log Reception on SRV2

On SRV2, you need to configure rsyslog to accept remote logs and write them to a specific file. Edit /etc/rsyslog.conf on SRV2 and ensure the following modules are loaded:

module(load="imtcp")
input(type="imtcp" port="514")

Then, create a rule to save the incoming BIND logs:

local2.* /var/log/srv1-bind-logs.log

Restart rsyslog on SRV2. To verify the setup, perform a DNS query on SRV1 (e.g., dig example.com @localhost) and then check the log file on SRV2. You should see entries containing the query details. If logs do not appear, check firewall rules on SRV2 to ensure port 514 is open for incoming TCP connections.

For more information on securing your server environment while managing logs, see Securing an Ubuntu Server for Development Purposes.

Frequently Asked Questions

What if I want to log firewall drops instead of DNS queries?

You should configure iptables or nftables with the --log-prefix option. This writes drop events to the kernel ring buffer, which rsyslog then captures. Refer to Block MAC Address with Iptables During Attack for specific syntax examples.

How do I filter only failed DNS lookups?

In the BIND logging section, you can change the severity to warn or error. Alternatively, use rsyslog filters on SRV2 to parse the log content and discard successful queries, keeping only those with status codes indicating failure.

Can I use UDP instead of TCP for forwarding?

Yes, replace @@ with @ in the rsyslog configuration on SRV1. UDP is faster but unreliable; packets may be lost if the network is congested. TCP ensures delivery but adds slight overhead.

Why are my logs not appearing on SRV2?

Check three things: 1) Is the firewall on SRV2 allowing inbound traffic on port 514? 2) Did you restart rsyslog on both servers after changes? 3) Are the facilities matching? Ensure SRV1 uses local2 and SRV2 listens for local2.

Is it safe to run BIND in debug mode on production?

No, debug mode generates excessive logs that can fill disk space quickly. Switch the severity back to info or warning once you have verified the logging pipeline works correctly.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More