- [Instructor] Hi, and welcome to the next video
of section eight.
Logging with syslog.
In the previous video,
we've learned about log file management with log rotate.
In this video, we'll discuss how to make use of syslogd
for logging information from a shell script.
Usually log files related to different daemons
and applications are located in the var slash log directory.
As it is the common directory for storing log files.
If you read through a few lines of log files,
you can see that lines in the log are in a common format.
In Linux, creating and writing log information to log files
at var slash log are handled by a protocol called syslog.
Handled by the syslogd daemon.
Every standard application makes use of syslog
for logging information.
Log files are very good for helping you deduce
what is going wrong with a system.
Hence while writing critical applications,
it's always good practice to log the progress
of an applications with messages into a log file.
We'll learn the command logger
to login to files with syslogd.
Before getting to know how to write into log files,
let's go through a list of important log files
used in Linux.
This indicates boot log information.
This indicates Apache web server log.
This indicates post-boot kernel information.
This indicates user authentication log.
This indicates system boot-up messages.
This indicates mail server log.
This indicates X server log.
Let's see how to use logger
to create and manage log messages.
In order to log to the syslog file,
slash var slash log slash messages, use.
The log file slash var slash log slash messages
is a general purpose log file.
When the logger command is used,
it logs to var log messages by default.
In order to log to the syslog with a specified tag, use.
Syslog handles a number of log files in var log.
However, while logger sends a message,
it uses the tag string to determine
in which log file it needs to be logged.
Syslogd decides to which file the log should be made
by using the tag associated with the log.
You can see the tag strings, and associated log files
from the configuration files located in
the /etc/rsyslog.d directory.
In order to login to a system log
with the last line from another log file, use.
Awesome.
We've successfully learned about logging with syslog.
In the next video,
we'll learn about monitoring user logins to find intruders.