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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • apache 虚拟主机配置详解_linux 配置虚拟主机

    apache 虚拟主机配置详解_linux 配置虚拟主机文章目录Apache虚拟主机企业应用部署一个端口不同域名调试worker工作模式进行压力测试权限设置Apache配置文件详解ApacheRewrite规则讲解Apache配置文件权限操作总结Apache虚拟主机企业应用企业真实环境中,一台WEB服务器发布单个网站会非常浪费资源,所以一台WEB服务器上会发布多个网站,少则3-5个,多则2-30。在一台服务器上发布多哥网站,也称之为部署多个虚拟主机,WEB虚拟主机配置方法有三种:基于单个IP地址多个Socket端口基于

    2026年1月14日
    6
  • 软件开发模型总结归纳(瀑布模型、螺旋模型、迭代模型、增量模型、敏捷模型)

    软件开发模型总结归纳(瀑布模型、螺旋模型、迭代模型、增量模型、敏捷模型)文章目录 0 软件的生命周期 1 瀑布模型 2 螺旋模型 3 迭代模型 4 增量模型 5 敏捷模型 0 软件的生命周期 软件的生命周期是指从软件产品的设想开始到软件不在使用而结束的时间 软件的生命周期分为 6 个阶段 即需求分析 计划 设计 编码 测试 运行维护 1 瀑布模型 瀑布模型是最早出现的软件开发模型 是所有其他软件开发模型的基础框架 与软件的生命周期不同的是 它缺少了软

    2025年9月1日
    3
  • 联手中信银行 物品互赠平台宣布“不卖只送”「建议收藏」

    联手中信银行 物品互赠平台宣布“不卖只送”「建议收藏」联手中信银行 物品互赠平台宣布“不卖只送”

    2022年4月21日
    56
  • linux常用命令杀死进程_kill杀死进程命令

    linux常用命令杀死进程_kill杀死进程命令在做项目的时候经常会出现程序死机、锁死、无响应等情况,这时候就需要找到程序相应的进程将其杀掉即可。步骤如下:1.定位进程top命令:可以实时动态地查看系统的整体运行情况,是一个综合了多方信息监测系统性能和运行信息的实用工具。通过top命令所提供的互动式界面,用热键可以管理。输入top后可以看到如下的界面,实时显示进程情况。ps命令:processstatus的简称,用于报告当…

    2022年4月19日
    237
  • 俞敏洪与新东方_新东方俞敏洪现状

    俞敏洪与新东方_新东方俞敏洪现状俞敏洪与新东方“江阴模式”助俞敏洪考上北大  俞敏洪,1962年出生于江苏省江阴。  俞敏洪出生在一个普通的农村家庭里,父亲是一名木匠,母亲则是当地生产队的妇女队长,她有与这一职位对应果敢的作风。俞敏洪还有一个姐姐,是一名赤脚医生。作为一个农家孩子,俞敏洪回忆:我从小就在农田里干活,插秧、割稻、撒猪粪,样样都干……  母亲希望他的人生能有某种意义上的改变,希望…

    2025年11月6日
    4
  • mysql获取当天时间数据_mysql获取今天日期

    mysql获取当天时间数据_mysql获取今天日期取当前时间:mysql>selectnow();前一小时的时间:mysql>selectdate_sub(now(),interval1hour);后一小时的时间:mysql>selectdate_add(now(),interval1hour);转载自:https://blog.csdn.net/weixin_39243289/article/details/87914601…

    2022年10月5日
    4

发表回复

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

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