Linux view system log ------ health check feature Nginx reverse proxy, health status detection, overload protection and detailed explanation of configuration files

last

https://www.cnblogs.com/anruy/articles/5541675.html                

Nginx reverse proxy, health status detection, overload protection and detailed explanation of configuration files

-a Display the host name or ip address from where to log in to the system on the last line. -d Specifies the log file. Specifies the log file. Convert IP addresses to hostnames. -f <logfile> Specifies the logfile. -n <number of displayed columns> or -<number of displayed columns> Sets the number of displayed columns in the list. -R Do not display the hostname or IP address of the logged in system. -x Display system shutdown, restart, and execution level changes and other information




See all the restart and shutdown records below

last | grep reboot
last | grep shutdown

history

List all history:

[zzs @ Linux ] # history

List only the last 10 records:

[zzs@linux] # history 10 (Note, there is a space between history and 10)

Use the command record number to execute the command, execute the 99th command in the history list

[zzs@linux] #!99 (no space between ! and 99)

Repeat the previous command

[zzs @ linux] # !!

Execute the last command starting with rpm (!? ? represents a string, this String can be entered at will, Shell will search forward from the last historical command, and the first matching command will be executed.)

[zzs @ linux] #! rpm

List all histories screen by screen:

[zzs@linux]# history | more

Immediately clear the records of all current history commands in history

[zzs @ linux] #history -c

cattail 和 watch

All the logs of the system are under /var/log to see by yourself (the specific purpose can be checked by yourself, and the appendix lists some commonly used logs)

cat / var / log / syslog 等
cat /var/log/*.log

tail -f

How to view tail -f /var/log/messages in real time if the log is updating

You can also use watch -d -n 1 cat /var/log/messages

-d means to highlight different places, -n means how many seconds to refresh.

This command does not directly return to the command line, but prints the newly added content in the log file in real time.
This feature is very effective for viewing logs. If you want to stop the output, just press Ctrl+C.

In addition, there are more,  less  , dmesg |more, which will not be listed here, because there are too many commands, the key depends on personal preferences and business needs. The ones that are commonly used by individuals are the above

linux log file description

/var/log/message Information and error logs after system startup, which is  one of the most commonly used logs in Red Hat
Linux /var/log/secure Security-related log information
/var/log/maillog Mail-related log information
/var/log/cron Log information related to scheduled tasks
/var/log/spooler Log information related to UUCP and news devices
/var/log/boot.log Log information related to daemon start and stop
/var/log/ wtmp This log file permanently records each user's login, logout, and system startup and shutdown events

 

 

 

-a Display the host name or ip address from where to log in to the system on the last line. -d Specifies the log file. Specifies the log file. Convert IP addresses to hostnames. -f <logfile> Specifies the logfile. -n <number of displayed columns> or -<number of displayed columns> Sets the number of displayed columns in the list. -R Do not display the hostname or IP address of the logged in system. -x Display system shutdown, restart, and execution level changes and other information




See all the restart and shutdown records below

last | grep reboot
last | grep shutdown

history

List all history:

[zzs @ Linux ] # history

List only the last 10 records:

[zzs@linux] # history 10 (Note, there is a space between history and 10)

Use the command record number to execute the command, execute the 99th command in the history list

[zzs@linux] #!99 (no space between ! and 99)

Repeat the previous command

[zzs @ linux] # !!

Execute the last command starting with rpm (!? ? represents a string, this String can be entered at will, Shell will search forward from the last historical command, and the first matching command will be executed.)

[zzs @ linux] #! rpm

List all histories screen by screen:

[zzs@linux]# history | more

Immediately clear the records of all current history commands in history

[zzs @ linux] #history -c

cattail 和 watch

All the logs of the system are under /var/log to see by yourself (the specific purpose can be checked by yourself, and the appendix lists some commonly used logs)

cat / var / log / syslog 等
cat /var/log/*.log

tail -f

How to view tail -f /var/log/messages in real time if the log is updating

You can also use watch -d -n 1 cat /var/log/messages

-d means to highlight different places, -n means how many seconds to refresh.

This command does not directly return to the command line, but prints the newly added content in the log file in real time.
This feature is very effective for viewing logs. If you want to stop the output, just press Ctrl+C.

In addition, there are more,  less  , dmesg |more, which will not be listed here, because there are too many commands, the key depends on personal preferences and business needs. The ones that are commonly used by individuals are the above

linux log file description

/var/log/message Information and error logs after system startup, which is  one of the most commonly used logs in Red Hat
Linux /var/log/secure Security-related log information
/var/log/maillog Mail-related log information
/var/log/cron Log information related to scheduled tasks
/var/log/spooler Log information related to UUCP and news devices
/var/log/boot.log Log information related to daemon start and stop
/var/log/ wtmp This log file permanently records each user's login, logout, and system startup and shutdown events

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324933514&siteId=291194637