Viewing Service Logs in Linux

45 minutes
  • 5 Learning Objectives

About this Hands-on Lab

Working with system logs is one of the most common tasks a Linux service administrator performs. Knowing where to find these logs and how to parse them into just the information you need saves time and effort in troubleshooting and resolution. In this hands-on lab, we will practice pulling data from the logs of a web server.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Attempt to `curl` the Address on the Local Host
  1. Run the following command:

    curl -I localhost
Determine How Many Times Has Accessed the Website
  1. Run the following command:

    sudo cat /var/log/httpd/access_log | grep -E "^" | wc -l
Attempt to Reach the Web Server via `http://PUBLIC_IP/index.html`
  1. Run the following command:

    sudo tail -f /var/log/httpd/access_log
  2. Attempt to reach the website via public IP (not from your computer as http://PUBLIC_IP/index.html.

Find the New Entry in the Log
  1. Run the following command to view the entry that was appended to the end of the log:

    sudo tail -f /var/log/httpd/access_log

    Note the "200" after "HTTP/1.1"; this signifies a valid destination.

Attempt to Reach the Web Server via `http://PUBLIC_IP/server.html`
  1. While running tail on the access log, attempt to reach the /server.html path:

    curl http://PUBLIC_IP/server.html

    Note the 404 status code; this signifies the path did not resolve to a valid page.

Additional Resources

You have been asked to determine if the web service on this host is successfully serving content at /index.html and /server.html. To do so, you must do the following:

  • Attempt to curl the address on the local host
  • Determine how many times has accessed the website
  • While viewing the access log, attempt to reach the web server from your computer via http://[PUBLIC IP]/index.html
  • Find the new entry in the log
  • Attempt to reach the web server from your computer via http://[PUBLIC IP]/server.html

By answering these questions, you can provide evidence of the web server successfully serving web pages.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Get Started
Who’s going to be learning?

How many seats do you need?

  • $499 USD per seat per year
  • Billed Annually
  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!