journalctl用法详解

journalctl用法详解文章目录一、journalctl命令简述二、journalctl常用选项一、journalctl命令简述journalctl[OPTIONS…][MATCHES…]Querythejournal.Flags:–systemShowthesystemjournal–userShowtheuserjournalforthecurrentuser-M–machine=CO

大家好,又见面了,我是你们的朋友全栈君。

一、journalctl命令简述

journalctl [OPTIONS...] [MATCHES...]

Query the journal.

Flags:
     --system              Show the system journal
     --user                Show the user journal for the current user
  -M --machine=CONTAINER   Operate on local container
  -S --since=DATE          Show entries not older than the specified date
  -U --until=DATE          Show entries not newer than the specified date
  -c --cursor=CURSOR       Show entries starting at the specified cursor
     --after-cursor=CURSOR Show entries after the specified cursor
     --show-cursor         Print the cursor after all the entries
  -b --boot[=ID]           Show current boot or the specified boot
     --list-boots          Show terse information about recorded boots
  -k --dmesg               Show kernel message log from the current boot
  -u --unit=UNIT           Show logs from the specified unit
  -t --identifier=STRING   Show entries with the specified syslog identifier
  -p --priority=RANGE      Show entries with the specified priority
  -e --pager-end           Immediately jump to the end in the pager
  -f --follow              Follow the journal
  -n --lines[=INTEGER]     Number of journal entries to show
     --no-tail             Show all lines, even in follow mode
  -r --reverse             Show the newest entries first
  -o --output=STRING       Change journal output mode (short, short-iso,
                                   short-precise, short-monotonic, verbose,
                                   export, json, json-pretty, json-sse, cat)
     --utc                 Express time in Coordinated Universal Time (UTC)
  -x --catalog             Add message explanations where available
     --no-full             Ellipsize fields
  -a --all                 Show all fields, including long and unprintable
  -q --quiet               Do not show privilege warning
     --no-pager            Do not pipe output into a pager
  -m --merge               Show entries from all available journals
  -D --directory=PATH      Show journal files from directory
     --file=PATH           Show journal file
     --root=ROOT           Operate on catalog files underneath the root ROOT
     --interval=TIME       Time interval for changing the FSS sealing key
     --verify-key=KEY      Specify FSS verification key
     --force               Override of the FSS key pair with --setup-keys

Commands:
  -h --help                Show this help text
     --version             Show package version
  -F --field=FIELD         List all values that a specified field takes
     --new-id128           Generate a new 128-bit ID
     --disk-usage          Show total disk usage of all journal files
     --vacuum-size=BYTES   Reduce disk usage below specified size
     --vacuum-time=TIME    Remove journal files older than specified date
     --flush               Flush all journal data from /run into /var
     --header              Show journal header information
     --list-catalog        Show all message IDs in the catalog
     --dump-catalog        Show entries in the message catalog
     --update-catalog      Update the message catalog database
     --setup-keys          Generate a new FSS key pair
     --verify              Verify journal file consistency

二、journalctl常用选项

  1. journalctl -e // Immediately jump to the end in the pager(立即跳到日志页面结尾处)
journalctl -e
1 04 18:30:32 server1 systemd[1]: Started Session 22 of user root.
1 04 18:30:32 server1 systemd[1]: Starting Session 22 of user root.
1 04 18:30:32 server1 CROND[55734]: (root) CMD (/usr/lib64/sa/sa1 1 1)
1 04 18:40:01 server1 systemd[1]: Started Session 23 of user root.
1 04 18:40:01 server1 systemd[1]: Starting Session 23 of user root.
1 04 18:40:01 server1 CROND[55818]: (root) CMD (/usr/lib64/sa/sa1 1 1)
1 04 18:50:01 server1 systemd[1]: Started Session 24 of user root.
1 04 18:50:01 server1 systemd[1]: Starting Session 24 of user root.
1 04 18:50:01 server1 CROND[55907]: (root) CMD (/usr/lib64/sa/sa1 1 1)
1 04 19:00:01 server1 systemd[1]: Started Session 25 of user root.
1 04 19:00:01 server1 systemd[1]: Starting Session 25 of user root.
1 04 19:00:01 server1 CROND[55997]: (root) CMD (/usr/lib64/sa/sa1 1 1)
1 04 19:01:01 server1 systemd[1]: Started Session 26 of user root.
1 04 19:01:01 server1 systemd[1]: Starting Session 26 of user root.
1 04 19:01:01 server1 CROND[56011]: (root) CMD (run-parts /etc/cron.hourly)
1 04 19:01:01 server1 run-parts(/etc/cron.hourly)[56014]: starting 0anacron
1 04 19:01:01 server1 run-parts(/etc/cron.hourly)[56020]: finished 0anacron
1 04 19:10:01 server1 systemd[1]: Started Session 27 of user root.
1 04 19:10:01 server1 systemd[1]: Starting Session 27 of user root.
1 04 19:10:01 server1 CROND[56105]: (root) CMD (/usr/lib64/sa/sa1 1 1)
  1. journalctl -u //查看指定单元 ( unit ) 的日志
journalctl -u httpd
[root@server1 ~]# journalctl -u httpd
-- Logs begin at  2020-11-22 04:33:29 CST, end at  2021-01-04 19:30:01 CST. --
1 04 19:24:46 server1 systemd[1]: Starting The Apache HTTP Server...
1 04 19:25:06 server1 httpd[56288]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::4f00:5a8e:3923:429d. Set the 'ServerName' directive 
1 04 19:25:26 server1 systemd[1]: Started The Apache HTTP Server.
1 04 19:27:57 server1 systemd[1]: Stopping The Apache HTTP Server...
1 04 19:27:58 server1 systemd[1]: Stopped The Apache HTTP Server.
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/142159.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • CAS单点登录原理详解

    CAS单点登录原理详解1、基于Cookie的单点登录的回顾    基于Cookie的单点登录核心原理:   将用户名密码加密之后存于Cookie中,之后访问网站时在过滤器(filter)中校验用户权限,如果没有权限则从Cookie中取出用户名密码进行登录,让用户从某种意义上觉得只登录了一次。   该方式缺点就是多次传送用户名密码,增加被盗风险,以及不能跨域。同时www.qiandu.co…

    2022年5月29日
    28
  • navicat永久激活码最新【2021最新】[通俗易懂]

    (navicat永久激活码最新)好多小伙伴总是说激活码老是失效,太麻烦,关注/收藏全栈君太难教程,2021永久激活的方法等着你。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.htmlKUKQYKZ5XE-eyJsaWNlbnNlSW…

    2022年3月22日
    399
  • Win10安装程序修复计算机,directx修复工具win10最新版

    Win10安装程序修复计算机,directx修复工具win10最新版directx修复工具win10最新版是一款以排除电脑软件异常导致的无法正常使用问题而特别打造的优质工具。全自动的智能检测修复功能能够确保用户们因为程序问题而导致的电脑异常无法使用都得到解决。directx修复工具win10最新版功能1、Directx修复增强版是一个系统DirectX组件修复工具,主要用于检测当前系统的DirectX状态。2、发现异常就进行修复。DirectX修复工具可以完美解决…

    2022年6月6日
    26
  • Django(20)ORM模型迁移命令

    Django(20)ORM模型迁移命令迁移命令makemigrations:将模型生成迁移脚本。模型所在的app,必须放在settings.py中的INSTALLED_APPS中。这个命令有以下几个常用选项:app_label:后面可

    2022年7月31日
    3
  • mysql添加唯一索引语句_mysql自动创建索引

    mysql添加唯一索引语句_mysql自动创建索引查看索引showindexfrom数据库表名altertable数据库addindex索引名称(数据库字段名称)PRIMARYKEY(主键索引)ALTERTABLE`table_name`ADDPRIMARYKEY(`column`)UNIQUE(唯一索引)ALTERTABLE`table_name`ADDUNIQUE(`column`)INDEX(普…

    2025年6月2日
    0
  • 数论——欧拉函数

    数论——欧拉函数定义小于n的正整数中与n互质的数的数目(φ(1)=1)通式证明:设p是N的质因子,1~N中p的倍数有p,2p,3p,…,(N/p)*p,共N/p个。同理,若q也是N的质因子,则1~N中q的倍

    2022年7月2日
    24

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号