Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How do I use journactl to view logs in a Centos7 system?

2025-01-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

How do I use journactl to view logs in a Centos7 system? I believe that most people do not know how to install, in order to let you learn, to give you a summary of the following, do not say much, let's look down together.

In Centos7 system, journactl is a commonly used log viewing tool, which can improve the efficiency of troubleshooting by making good use of log tools.

Systemd uniformly manages startup logs for all Unit.

The configuration file / etc/systemd/journald.conf of the log is fine by default, and generally does not need to be changed.

View all logs (by default, only the logs for this startup are saved)

The following are the more useful log viewing commands.

Journalctl

View kernel log (application log is not displayed)

Journalctl-k

View the log at a specified time

For example: "display all log information between 19:14:30 and the current time on March 12, 2020" journalctl-- since= "2020-03-12 19:14:30"

Scenario: after the release of the project, the java program does not start normally, check the release time, 1914; filter the log through the command, you can tell the developer if you make an error and understand it, and send it to the developer to check if you don't understand it, and quickly find the reason.

Get the log for the first 20 minutes of the current time

Journalctl-since "20 min ago"

Get log information from a certain day to a certain time period

Journalctl-since "2020-03-12"-- until "2020-03-13 03:00"

Tracking log

Journalctl-f

Filter program option-u

Journalctl-u httpd.service

The journal log file is too large, how to delete the log size.

The log size is set to 1 G

Journalctl-- vacuum-size=1024M to check the log file size: (this is only a temporary setting of the log size, which will grow to the default 4 GB later) du-sh / var/log/journal/

More can be seen through help

Journalctl-h

After reading the above, have you mastered the method of using journactl to view logs in the Centos7 system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report