[go: up one dir, main page]

0% found this document useful (0 votes)
55 views2 pages

Linux Log Troubleshooting Guide

The document discusses viewing logs on Linux. It explains that logs are stored in /var/log and can be viewed with commands like ls and cat. It describes troubleshooting a "low disk space" error by using du, sort, and head to find the largest files and deleting an unnecessary large file to resolve the issue. It directs the user to address the remaining log entries by applying lessons from previous labs on updating software, deleting files, modifying permissions, and terminating processes.

Uploaded by

arunajith897
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views2 pages

Linux Log Troubleshooting Guide

The document discusses viewing logs on Linux. It explains that logs are stored in /var/log and can be viewed with commands like ls and cat. It describes troubleshooting a "low disk space" error by using du, sort, and head to find the largest files and deleting an unnecessary large file to resolve the issue. It directs the user to address the remaining log entries by applying lessons from previous labs on updating software, deleting files, modifying permissions, and terminating processes.

Uploaded by

arunajith897
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Viewing logs on Linux

On Linux machines, logs are stored in the /var/log directory. There are lots of log files in this directory, and you can view them with this
command:

ls /var/log
content_copy

We're interested in syslog for the moment. The logs on Linux can be viewed like any text file; you can use the command below to view the
contents of syslog:

sudo cat /var/log/syslog


content_copy
The log contents are super long, so you'll have to scroll through the logs to look for the five entries that are relevant to this lab. The logs are
entered chronologically, and the logs that you'll need to fix should be timestamped around the time that the lab started. For convenience, all of
the log entries you need to fix contain the phrase "Qwiklab Error". Knowing this, you could also filter out the relevant labs using the grep
command.

We'll walk through addressing one of the log's issues, then the other four will be up to you!

Low disk space!

Here's the log entry we will be dealing with first:

This error indicates that your computer is running out of memory due to a super large file. Unfortunately, it doesn't indicate which file is causing
the problem, so you'll need to find it. Luckily, Linux has an easy way to find the largest files on your file system. The du command can be used
to list all files in a directory (recursively through subdirectories, too), which you can sort by size to find the largest files. By piping the output of
du (using the "|" symbol) to the sort command, you can sort the output by file size. The "-n" and "-r" flags tell sort to treat the string output on
each line as a number (the file size), and to sort in reverse order so that the largest files are listed first. By piping the output of this into
the head command, you can print out only the top few results (you can specify how many to output by adding "-n [NUMBER]" to the end of the
command).

The command below uses du, sort, and head to show the top five largest files, starting from your /home directory:

sudo du -a /home | sort -n -r | head -n 5


content_copy

You can see that the largest file in your home directory is /home/lab/storage/ultra_mega_large.txt, at about 5GB. This isn't an important file, but
it's taking up a lot of space, so you can delete it to fix the disk space error:

sudo rm /home/lab/storage/ultra_mega_large.txt
content_copy
Now that the large file is gone, this log's issue has been dealt with. You can see that the log entry is still present in the log file; logs aren't deleted
once the errors that caused them are resolved.

The remaining log entries


The rest of the logs involve issues that you have already successfully fixed in earlier labs in this course. Refer back to those lessons and labs to
refresh yourself on the required steps, if you’re stuck:

 Updating software that's out-of-date (Week 3 Labs)


 Finding and deleting files (Week 1 Labs)
 Modifying file permissions (Week 2 Labs)
 Finding and terminating specific processes (Week 5 Labs)
If you’d like to check your steps along the way, refer to your score in the top right of the lab. Click the score and run each step to check
individually as you go. Good luck!

Note: Please make sure that you are running the commands using sudo. The purpose of sudo is to execute the command given to it with root
privileges.

You might also like