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


相关推荐

  • java程序编译命令_使用 java 命令编译运行 java 程序

    java程序编译命令_使用 java 命令编译运行 java 程序java编译的过程,就是将java项目从源文件变成.class文件的过程,而.class文件,最后会被加载到JVM中运行。在JDKbin/目录下,提供了javac命令,用于将.java源文件编译成.class字节码文件,提供了java命令,以Main_Class为入口,根据运行需要,加载相应的class文件到JVM中执行。关于环境变量如果在没有引用…

    2022年7月8日
    26
  • 【linux】Redhat Linux 关闭防火墙命令[通俗易懂]

    【linux】Redhat Linux 关闭防火墙命令[通俗易懂]1

    2025年9月19日
    4
  • LoadRunner详细使用教程

    LoadRunner详细使用教程文章目录VirturalUserGeneratorControllerAnalysisloadrunner的使用VirturalUserGenerator:录制脚本Controller:场景测试,收集并发测试的数据(多个用户并发场景)Analysis:分析系统并发测试的数据,生成报告和图标loadrunner做性能测试的原理?性能测试主要是多用户的并发,就是多线程模拟用户的操作,什么是集合点,为什莫需要集合点?因为先初始化好的线程需要等待后面还没初始化好的线程,所以设置一个集合点

    2022年5月23日
    65
  • 手把手教你学DSP(TMS320X281X) 2020-11-30

    手把手教你学DSP(TMS320X281X) 2020-11-30内容为自己看《手把手教你学dspTMS320X281X》(顾卫刚版)图书的笔记,只是记录一下自己学习的思想历程。由于自己硬件学习也是新手,如有错误,请评论或者私信指出,如果看见一定更正;如果感觉本文对您有帮助,可以给个点赞;顺便可以关注或收藏一波不迷路。

    2022年4月30日
    48
  • IdeaVim 基本操作[通俗易懂]

    IdeaVim 基本操作[通俗易懂]IdeaVim基本操作安装插件ideaVim剪贴板与系统剪贴板同步CapsLock键映射为Esc键光标的移动安装插件File-Settings-Plugins,BrowseRepositories,输入ideavim,安装2.重启IntelliJIDEAideaVim剪贴板与系统剪贴板同步在ideavimrc文件中添加一行:setclipboard=unnamedplus,unnamed保存并退出:wq重启IntelliJIDEACaps

    2022年10月1日
    2
  • git项目怎么用_git详细教程

    git项目怎么用_git详细教程项目开发git的基本使用流程项目开发git仓库使用流程一、新建项目以及首次推送1、git上新建项目2、在项目下创建属于该项目的代码仓库(选择私有仓库)3、完成创建后在自己本地的项目文件夹下使用“gitinit”初始化该文件夹4、“gitadd.”将工程内的所有文件放入暂存区5、”gitcommit-m“xxxxxxx””这次提交的信息,”xxxxxx”提交备注尽可能的写的详细,方面后续查找问题6、“gitremoteaddoriginxxxxxxxxxxxxx

    2022年9月15日
    0

发表回复

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

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