Bird
Raised Fist0
Cybersecurityknowledge~20 mins

Logging and audit trails in Cybersecurity - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Logging and Audit Trails Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Output of syslog command filtering
What is the output of the following command on a Linux system with syslog configured?

sudo grep "ERROR" /var/log/syslog | tail -n 3

Assume the last three ERROR entries in syslog are:
1. "ERROR: Disk quota exceeded"
2. "ERROR: Failed to start service"
3. "ERROR: Network unreachable"
Cybersecurity
sudo grep "ERROR" /var/log/syslog | tail -n 3
ANo output, command returns empty
B
ERROR: Network unreachable
ERROR: Failed to start service
ERROR: Disk quota exceeded
C
ERROR: Disk quota exceeded
ERROR: Network unreachable
ERROR: Failed to start service
D
ERROR: Disk quota exceeded
ERROR: Failed to start service
ERROR: Network unreachable
Attempts:
2 left
💡 Hint
The tail command shows the last lines in the order they appear.
🧠 Conceptual
intermediate
1:30remaining
Purpose of audit trails in security
Which of the following best describes the primary purpose of audit trails in cybersecurity?
ATo automatically block unauthorized access attempts in real-time
BTo encrypt data during transmission to prevent interception
CTo record user activities and system events for accountability and forensic analysis
DTo backup system files regularly to prevent data loss
Attempts:
2 left
💡 Hint
Think about what audit trails help you do after an event happens.
❓ Troubleshoot
advanced
2:30remaining
Troubleshooting missing log entries
A system administrator notices that some critical security events are missing from the audit log file. Which of the following is the most likely cause?
AThe audit daemon configuration excludes those event types from logging
BThe system clock is set to the wrong time zone
CThe log file permissions are set to read-only for all users
DThe disk space is sufficient and logs are rotating properly
Attempts:
2 left
💡 Hint
Consider what controls which events get logged.
🔀 Workflow
advanced
3:00remaining
Steps to secure audit logs
Which sequence of steps correctly describes how to secure audit logs to prevent tampering?
A2,1,4,3
B1,2,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint
Think about setting up, protecting, forwarding, then verifying logs.
✅ Best Practice
expert
2:30remaining
Best practice for log retention policy
What is the best practice for defining a log retention policy in a secure environment?
ARetain logs only as long as needed to meet compliance and forensic requirements, then securely delete
BKeep all logs indefinitely to ensure no data is lost
CArchive logs without encryption to simplify access
DDelete logs daily to save disk space and improve performance
Attempts:
2 left
💡 Hint
Balance between compliance needs and storage management.

Practice

(1/5)
1. What is the main purpose of logging in cybersecurity?
easy
A. To speed up the computer's processing power
B. To record important system and user actions for review
C. To delete old files automatically
D. To block unauthorized users from accessing the system

Solution

  1. Step 1: Understand the role of logging

    Logging is used to keep a record of system and user activities.
  2. Step 2: Identify the correct purpose

    Logging helps in reviewing actions for security and troubleshooting.
  3. Final Answer:

    To record important system and user actions for review -> Option B
  4. Quick Check:

    Logging = Record actions [OK]
Hint: Logging means recording actions, not blocking or deleting [OK]
Common Mistakes:
  • Confusing logging with access control
  • Thinking logging speeds up processing
  • Assuming logging deletes files
2. Which of the following is the correct syntax to configure a basic log file in Linux using rsyslog?
easy
A. *.info /var/log/messages*
B. *.info /var/log/messages;
C. *.info > /var/log/messages
D. *.info /var/log/messages

Solution

  1. Step 1: Review rsyslog syntax basics

    In rsyslog, the format is: selector action, e.g., '*.info /var/log/messages'.
  2. Step 2: Identify the correct syntax

    *.info /var/log/messages matches the correct syntax without extra characters.
  3. Final Answer:

    *.info /var/log/messages -> Option D
  4. Quick Check:

    rsyslog syntax = selector + space + file path [OK]
Hint: No semicolon or special chars after file path in rsyslog config [OK]
Common Mistakes:
  • Adding semicolon at end of line
  • Using > instead of space for file path
  • Appending extra characters like * after file path
3. Given this snippet from a log file:
2024-06-01 10:15:30 user1 LOGIN SUCCESS
2024-06-01 10:16:05 user2 LOGIN FAILURE
2024-06-01 10:17:00 user1 LOGOUT

What event happened at 10:16:05?
medium
A. User2 failed to log in
B. User1 logged out
C. User1 logged in successfully
D. User2 logged in successfully

Solution

  1. Step 1: Read the log entry at 10:16:05

    The log shows 'user2 LOGIN FAILURE' at that time.
  2. Step 2: Interpret the event

    This means user2 tried to log in but failed.
  3. Final Answer:

    User2 failed to log in -> Option A
  4. Quick Check:

    LOGIN FAILURE = failed login [OK]
Hint: Look for LOGIN FAILURE to spot failed login attempts [OK]
Common Mistakes:
  • Mixing user1 and user2 events
  • Confusing LOGIN SUCCESS with FAILURE
  • Ignoring timestamps
4. You configured auditd to log file access but notice no logs are generated. Which is the most likely cause?
medium
A. auditd service is not running
B. The log file is too large
C. The system clock is incorrect
D. The user has admin rights

Solution

  1. Step 1: Check auditd service status

    If auditd is not running, no audit logs will be created.
  2. Step 2: Rule out other options

    Log file size or system clock issues do not stop logging; admin rights do not prevent logs.
  3. Final Answer:

    auditd service is not running -> Option A
  4. Quick Check:

    auditd must run to log events [OK]
Hint: Ensure auditd service is active to generate logs [OK]
Common Mistakes:
  • Assuming large log files stop logging
  • Blaming system clock for missing logs
  • Thinking admin rights block logging
5. You want to create an audit trail that records user login and logout times, but only for users in the 'admin' group. Which approach best achieves this?
hard
A. Manually check login times daily for admin users
B. Enable system-wide logging for all users without filters
C. Configure audit rules to watch /var/log/auth.log and filter by admin group users
D. Disable logging for non-admin users

Solution

  1. Step 1: Understand audit trail requirements

    We need logs for login/logout only for admin group users.
  2. Step 2: Choose filtering method

    Configuring audit rules to watch auth logs and filter by group targets only admin users.
  3. Step 3: Evaluate other options

    System-wide logging is too broad; manual checks are inefficient; disabling logging for others may miss events.
  4. Final Answer:

    Configure audit rules to watch /var/log/auth.log and filter by admin group users -> Option C
  5. Quick Check:

    Audit rules + filtering = targeted logs [OK]
Hint: Use audit rules with filters to log specific user groups [OK]
Common Mistakes:
  • Logging all users wastes resources
  • Relying on manual checks is error-prone
  • Disabling logs risks missing important events