312-39 practice question 15 of 35

Which of the following command is used to view iptables logs on Ubuntu and Debian distributions?

Full set: 100 questions
Answer options
A: $ tailf /var/log/sys/kern.log
B: $ tailf /var/log/kern.log Correct answer
C: # tailf /var/log/messages
D: # tailf /var/log/sys/messages
Correct Answer:
B. $ tailf /var/log/kern.log
Explanation

On Debian-based Linux distributions, including Ubuntu, the kernel's logging facility (klogd or its equivalent in systemd-journald) directs kernel messages to /var/log/kern.log. Since iptables is a kernel-level firewall operating within the netfilter framework, its log entries are considered kernel messages. A Security Operations Center (SOC) analyst would use a command like tailf or tail -f to monitor this file in real-time for firewall-related events.

Why Incorrect

A. The path /var/log/sys/kern.log is incorrect. The sys subdirectory is not the standard location for this log file on Debian or Ubuntu systems.
C. The file /var/log/messages is the standard destination for general system activity logs on Red Hat-based distributions (like RHEL, CentOS, Fedora), not Debian/Ubuntu.
D. The path /var/log/sys/messages is incorrect, combining the non-standard sys directory with the log file name used by a different family of Linux distributions.

References

Ubuntu Community Help Wiki, "SystemLog". This official documentation specifies that /var/log/kern.log is the file that "contains kernel log messages."

The Debian Administrator's Handbook, 2nd Edition (2021), Section 8.3.1. "Log Files". The handbook states, "The kernel's messages are in a separate file, /var/log/kern.log".

Scroll to Top