Skip to content

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
  • Labs icon Lab
  • A Cloud Guru
Google Cloud Platform icon

Configuring Remote Logging on Linux

In this hands-on lab, you will configure remote logging from one server to another. The goal of this activity is to gain experience with being able to set up logging between servers. In this activity, you need to configure *Server1* as the log host for *Server2*. *This course is not approved or sponsored by Red Hat.*

Google Cloud Platform icon

Path Info

Clock icon Intermediate
Clock icon 1h 0m
Clock icon Apr 04, 2019

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Configure Server1 to receive logs.

    Server1 will need to be configured to receive logs via TCP.

    Uncomment the following section within /etc/rsyslog.conf:

    $ModLoad imtcp
    $InputTCPServerRun 514

    Then, under the line starting with local7.*, add the following:

    $template DynFile,"/var/log/hosts/system-%HOSTNAME%.log"
    *.* -?DynFile

    Restart the rsyslog service.

    Verify the host is listening on port 514.

    Open the firewall to permanently permit incoming traffic on TCP port 514 and reload it.

  2. Challenge

    Configure Server2 to send logs to Server1.

    Verify Server2 can connect to Server1 over TCP port 514.

    On Server2, modify the /etc/rsyslog.conf file.

    Uncomment the following lines:

    $ActionQueueFileName fwdRule1 # unique name prefix for spool files
    $ActionQueueMaxDiskSpace 1g   # 1gb space limit (use as much as possible)
    $ActionQueueSaveOnShutdown on # save messages to disk on shutdown
    $ActionQueueType LinkedList   # run asynchronously
    $ActionResumeRetryCount -1    # infinite retries if host is down

    Uncomment the following line and edit as follows:

    *.* @@

    Restart the rsyslog service.

  3. Challenge

    Verify logs are being sent to Server1.

    Verify the /var/log/hosts directory was created and is being populated.

    Use tail on the /var/log/hosts/system-ip-10-0-1-11.log file to see entries from Server2.

    You can use the logger command to add entries to the log:

    On Server2, enter the following command 3 times:

    logger "THIS IS A TEST"

    Verify these entries are showing up in the log file on Server1.

The Cloud Content team comprises subject matter experts hyper focused on services offered by the leading cloud vendors (AWS, GCP, and Azure), as well as cloud-related technologies such as Linux and DevOps. The team is thrilled to share their knowledge to help you build modern tech solutions from the ground up, secure and optimize your environments, and so much more!

What's a lab?

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.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.

Start learning by doing today

View Plans