大网数据广告活动
服务器运维问答

How to combine output of several journals by journalctl?

· 52CE 我爱测

I need to see all postgresql logs. I try: $ journalctl -f -u postgresql.service SYSLOG_IDENTIFIER=postgres -- Logs begin at Ср 2013-03-06 00:57:40 KRAT. -- авг 11 23:41:07 nuzzflonk postgres[2432]: LOG: database system was interr…

问题原文

原帖链接 · Vladislav · CC BY-SA 3.0

I need to see all postgresql logs. I try:

$ journalctl -f -u postgresql.service SYSLOG_IDENTIFIER=postgres
-- Logs begin at Ср 2013-03-06 00:57:40 KRAT. --
авг 11 23:41:07 nuzzflonk postgres[2432]: LOG:  database system was interrupted; last known up at 2013-08-11 20:12:28 KRAT
авг 11 23:41:07 nuzzflonk postgres[2432]: LOG:  database system was not properly shut down; automatic recovery in progress
авг 11 23:41:07 nuzzflonk postgres[2432]: LOG:  record with zero length at 5/DACF208
авг 11 23:41:07 nuzzflonk postgres[2432]: LOG:  redo is not required
авг 11 23:41:07 nuzzflonk postgres[2432]: LOG:  autovacuum launcher started
авг 11 23:41:07 nuzzflonk postgres[2432]: LOG:  database system is ready to accept connections
-- Reboot --
авг 19 20:23:22 nuzzflonk postgres[2361]: FATAL:  the database system is starting up
авг 19 20:23:22 nuzzflonk postgres[2361]: LOG:  database system was shut down at 2013-08-19 20:21:25 KRAT
авг 19 20:23:22 nuzzflonk postgres[2361]: LOG:  autovacuum launcher started
авг 19 20:23:22 nuzzflonk postgres[2361]: LOG:  database system is ready to accept connections

But:

$ journalctl -f SYSLOG_IDENTIFIER=postgres 
-- Logs begin at Ср 2013-03-06 00:57:40 KRAT. --
авг 24 10:50:07 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction
авг 24 11:10:07 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction
авг 24 11:20:07 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction
авг 24 11:30:07 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction
авг 24 11:40:07 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction
авг 24 11:50:08 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction
авг 24 12:00:07 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction
авг 24 12:30:07 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction
авг 24 12:40:07 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction
авг 24 12:50:07 nuzzflonk postgres[2361]: LOG:  unexpected EOF on client connection with an open transaction

How to combine two journals?

UPD: Solved. $ journalctl -f SYSLOG_IDENTIFIER=postgres show all journals.

社区高分解答

原帖链接 · TCB13 · CC BY-SA 4.0

To combine the output of multiple journals you just need to add them to your command using the -u option as follows:

journalctl -u nginx.service -u mysql.service -f

No need to use SYSLOG_IDENTIFIER as that will likely not be what you want in most cases.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2013-08-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0 / CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。