- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我只想查看指定时间范围 (08:00 - 11:00) 内所有日期创建的日志消息。
如果我使用:
journalctl --since 08:00 --until 11:00
它只显示当天的日志。
有什么想法吗?
最佳答案
首先 - 您的 journalctl 日志文件在哪里?默认journalctl收集自系统启动以来的日志。
默认情况下,日志文件位于/var/log/journal。如果此目录不存在,请在 /etc/systemd/journald.conf 中设置 Storage=persistent 并运行 systemctl restart systemd-journald。
当 journalctl 保存所有日期的所有消息/事件时,或者当系统从保存设置日的几天收集日志时,您可以通过这种方式从 journalctl 中提取一些有趣的信息:
# Define year
year="2016"
# Defines the month in which you want to search
months=(08 09 10)
for i in "${months[@]}" ; do
# To set a range of days: 14 - 20
for j in `seq 14 20` ; do
journalctl --since "${year}-${i}-${j} 08:00:00" --until "${year}-${i}-${j} 11:00:00" >> /tmp/journal.${year}-${i}-${j}.log
done
done
如果你想检查从 1 到 9 的天数,可能需要添加一个机制来添加 0 (01, 02, 03, ..., 09)。
这是一个示例,您必须根据自己的需要进行调整。
关于Linux: journalctl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40152339/
我需要从我的 systemd 日志文件中收集一些统计信息,比如有多少用户将某个查询字符串参数传递给我的服务。我知道我可以在 journalctl 中查看此信息,但我无法弄清楚如何在 Go 中这样做以便
我只想查看指定时间范围 (08:00 - 11:00) 内所有日期创建的日志消息。 如果我使用: journalctl --since 08:00 --until 11:00 它只显示当天的日志。 有
使用 journalctl,可以通过指定它们可以使用的最大磁盘空间、它们可以拥有的最长期限或单独日志文件的最大数量(使用选项 --vacuum-size 、 --vacuum-time )来删除旧日志
我最近在浏览journalctl的源代码,发现了一段我不太清楚的代码。 我正在谈论的部分就在这里: https://github.com/systemd/systemd/blob/9e83569d8f
我的 journalctl到处都是gnome-session警告。我已将问题追溯到谷歌浏览器,警告相对无害。然而,它淹没了我的日志输出,坦率地说,如果我确实需要检查它,我将无法找到我需要的东西。 Ma
我正在运行一个包含多个主机的环境,所有主机都使用 journald (systemd-journal-remote) 将它们的日志文件发送到一个中央日志主机。在中央日志主机上,可以使用 -m (-me
我有一个较旧的守护进程,我认为它没有像以前那样被“系统化”,我不知道如何将日志从它发送到 journalctl,我也无法在任何地方找到答案.我在 systemd 下的几个守护进程中遇到过这个问题。我目
当我在 Centos 7 Linux 终端中以 root 用户身份运行以下命令时,会产生 57 行输出: journalctl --output=json-pretty UNIT=firewalld.
docker.service - Docker Application Container Engine Loaded: loaded (/lib/systemd/system/docker.s
我正在编写一个 bash 脚本,它将在屏幕上打印来自已终止(或仍然存在,两种情况都必须有效)的服务的所有最新日志。我知道它的名字,不用猜。 我很难为已经死于 journalctl 的进程获取最新的 P
我将 systemd-journal 视为一种从外部处理器收集日志的方法。我对它在必要时收集二进制数据的能力非常感兴趣。 我现在只是在测试和调查日志。我很清楚还有其他可能更好的解决方案。 我正在像这样
解析 journelctl 文件时,要查找的关键字是:error、boot、warning、traceback 一旦遇到关键字,我需要为每个关键字增加计数器并打印匹配行。 所以,我试过如下;从文件中读
使用命令: /usr/bin/journalctl -o short -f | ncat {some-ip} {some port} 将日志输出转发到一些远程日志跟踪应用程序。 问题是我在打印输出中缺
上次我尝试在 localhost 上添加新域并且我将其保留几周,所以现在我尝试运行我的 apache 这个命令 /etc/init.d/apache2 start我得到错误 [....] Starti
我在 Centos 机器上使用 Tomcat 9。来自 Tomcat 应用程序的日志在/opt/tomcat/logs.catalina.out 中生成。有没有办法将这些日志传递给服务日志(journ
我安装了 Centos 7 的新副本。然后我重新启动了 Apache,但 Apache 无法启动。我在这个问题上停留了 3 天。连支持都想不通这个错误。 sudo service httpd star
我正在尝试安装 maria db 并遇到以下问题。 [root@localhost ~]# service mysqld start Redirecting to /bin/systemctl sta
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
我是一名优秀的程序员,十分优秀!