Which command filters the system journal for a specific service and shows entries from the last hour?

Prepare for the Red Hat Certified Systems Admin Exam EX200. Enhance your skills with interactive quizzes, flashcards, and detailed explanations. Ace your certification exam today!

Multiple Choice

Which command filters the system journal for a specific service and shows entries from the last hour?

Explanation:
To get logs for a specific systemd service within the last hour, you combine a unit filter with a time window. Use the service unit with a time filter that defines the start of the window, such as --since "1 hour ago". This retrieves entries from one hour ago up to now, which is exactly the last hour. Using --until would set the end of the window to one hour ago, so you’d miss the most recent hour of logs. Filtering by a tag with -t would pull entries by a syslog tag, not specifically by the service unit, which isn’t what you want for a particular service. The long option --unit is equivalent to -u, so either form works, but the key is pairing the unit filter with --since to capture the last hour.

To get logs for a specific systemd service within the last hour, you combine a unit filter with a time window. Use the service unit with a time filter that defines the start of the window, such as --since "1 hour ago". This retrieves entries from one hour ago up to now, which is exactly the last hour.

Using --until would set the end of the window to one hour ago, so you’d miss the most recent hour of logs. Filtering by a tag with -t would pull entries by a syslog tag, not specifically by the service unit, which isn’t what you want for a particular service. The long option --unit is equivalent to -u, so either form works, but the key is pairing the unit filter with --since to capture the last hour.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy