1. Log
The process and operating system cores need to be able to log the events that occur, which can be used for system audits and troubleshooting problems. By management, these logs are permanently stored in the/var/log
In the red HAT7 version, there are two log services, namely Rsyslog and systemd-journal
Systemd-journal is an improved log management service that collects messages from the kernel, early stages of the boot process, standard output, system logs, and errors during daemon startup and operation. It writes these messages to a structured event, where the log is not persisted by default, and the previous log is lost after each reboot. In addition, some rsyslog logs that cannot be collected are also written to systemd-journal.
(1). Rsyslog logs that are collected are recorded in each log file in the/var/log directory.
650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M01/81/FD/wKiom1dGuQ-wxc8pAABGYYDR2H8878.png "title=" Qq20160526165115.png "alt=" Wkiom1dguq-wxc8paabgyydr2h8878.png "/>
Systemctl status Rsyslog See if Rsyalog service is running
Its configuration file is in/etc/rsyslog.conf
For each log type, log a class of logs into a file.
(2). Log level
Number |
Priority level |
Severity |
0 |
Emerg |
System not available |
1 |
Alert |
Immediate measures must be taken |
2 |
Crit |
Critical condition |
3 |
Err |
A very serious error condition. |
4 |
Warning |
Warning |
5 |
Notice |
A normal but important event |
6 |
Info |
Informational Events |
7 |
Debug |
Debug level messages |
View Rsyslog configuration file: vim/etc/rsyslog.conf
Any configuration files that have been modified must be restarted.
(3). View SYSTEMD log Entry specific commands Journalctl
Journalctl used to view all the logs
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M00/81/FC/wKioL1dGvT7SRagnAADTernmseY288.png "title=" Qq20160526170504.png "alt=" Wkiol1dgvt7sragnaadternmsey288.png "/>
Journalctl-n [NUM] Displays the last 10 log entries by default
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/81/FC/wKioL1dGvcyBkclfAACZ69Z6zSM659.png "title=" Qq20160526170726.png "alt=" Wkiol1dgvcybkclfaacz69z6zsm659.png "/>
Journalctl-p Err filtering log level output
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/81/FE/wKiom1dGvVGgJp1gAADjpQCx66Y143.png "title=" Qq20160526170931.png "alt=" Wkiom1dgvvggjp1gaadjpqcx66y143.png "/>
You can also output a specific time range, two options-since and-until, the accepted time format is YYY-MM-DD hh:mm:ss, if the date is omitted, the command is assumed to be the date of the day, and if the time is omitted, it is assumed to be 00:00:00, except for the specific date time. These two options also accept yesterday,today,tomorrow.
(4). Save SYSTEMD Log
Typically saved in/etc/log/journal, this allows you to persist the SYSTEMD log, but only one months of log information is saved by default, which can be adjusted in the configuration file/etc/systemd/journald.conf
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/81/FE/wKiom1dGv87Dlk2hAABwC7abk58193.png "title=" Qq20160526172006.png "alt=" Wkiom1dgv87dlk2haabwc7abk58193.png "/>
2. Check the system time in Red HAT7
Command |
Explain |
Timedatectl |
View system time |
Timedatectl List-timezones |
List Time zone information |
Timedatectl Set-timezone Asia/shanghai |
Setting the time zone |
Timedatectl set-time 22:19:00[yyy-mm-dd Hh:mm:ss] |
Set time and date |
Timedatectl Set-ntp[true|false] |
To start or disable NTP (Network Time Protocol) synchronization |
The configuration file is in/ETC/CHRONY.CONFZ.
3. Scheduled Tasks
(1). Perform a task at some point in the future
Related command: At is relatively simple, not much to say
(2). Perform a task periodically
Cron: Self is a service that runs uninterrupted
For cron tasks, there are two categories: System cron task, user-independent, System periodic maintenance, format: minutes and hours of the day and month user tasks
User Cron task: usually defined in the/var/spool/cron/username directory
Format: minutes hours Sun Moon Week task
Valid values for TIME:
Minutes 0-59 Hours 0-23 Day 1-31 Month 1-12 Weeks 0-7, 0, and 7 mean Sunday.
|
Time wildcard characters:
* All valid values corresponding to
, discrete-time point values
-Continuous point in time
/how often in the corresponding value range
Management of user cron tasks:
Crontab This command enables the detection of syntax:
Options |
Explain |
-L |
List the cron tasks for the current user |
-E |
Edit the cron task for the current user |
-R |
Remove all cron tasks |
-U USERNAME |
Manage cron for other users, only root is available |
4. Host Name
Hostname Viewing host names
Hostname "hostname" temporarily modifies host name
The static hostname is saved in the/etc/hostname file, and Hostnamectl can modify the file
HOSTNAMECTL set-hostname hostname permanently Modify host name
There is a name resolution: used to convert the host name to an IP address, or vice versa.
Logs, scheduled tasks, host names, System time