Get the App
SLTechnology News&Howtos  ›  Servers  › 

Use the swatch command of linux for system monitoring

Shulou Source: shulou.com Published: 2022-06-02 12:42:22 10月26日 Update

Xiaobian to share with you the use of linux swatch command for system monitoring, I hope you read this article after the harvest, let us discuss it together!

Swatch can be used to monitor system log files and perform specified actions when specific events are detected. Use the configuration file ".swatchrc" that requires a preset swatch before using it. The ".swatchrc" file can be modified as required to monitor events and actions performed.

Syntax format: swatch [parameter]

Common parameters:

-A specifies the action separator character in the default profile, preset to comma-c specifies the profile, instead of using the default profile-f checks the specified log file, does not continue to monitor the log file after checking-I specifies the separator character for input records, preset to newline character-P specifies the event separator character in the profile, preset to comma-r Restart at specified time-t checks the specified log file, and monitors subsequent records added to the log file

Reference Example

Activate system monitoring:

[root@linuxcool ~]# swatch

Select the configuration file (note the file path) and execute write log to/var/log/secure.1

[root@linuxcool ~]# swatch -c /root/abc.conf --examine=/var/log/secure.1 After reading this article, I believe you have a certain understanding of using linux swatch command for system monitoring. If you want to know more about it, welcome to pay attention to the industry information channel. Thank you for reading!

Tags: Files monitoring configuration systems characters events actions checks commands parameters articles commas done instances frequently used logs time more formats monitoring system Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Apple vpn Shulou Tech Info MariaDB