我有一个正在运行的 systemd 单元,我想跟踪它的日志。
我知道我可以使用以下方法显示单位的日志:
journalctl -u my_unit.service
Run Code Online (Sandbox Code Playgroud)
但这仅打印当前日志而不遵循它们。
我知道我还可以systemd
使用以下方法跟踪日志:
journalctl -f
Run Code Online (Sandbox Code Playgroud)
但这会通过跟踪所有已知日志来发送垃圾邮件,因此我必须搜索我感兴趣的内容。
一个临时解决方案似乎是通过管道跟踪日志来 grep 过滤输出,但这不是很系统的解决方案:
journalctl -f | grep "what i'm interested in"
Run Code Online (Sandbox Code Playgroud)
不是有跟踪某个单位的日志的命令吗?
我已经尝试过,但没有奏效:
journalctl -uf my_unit.service
Run Code Online (Sandbox Code Playgroud) 我有这些 SSH 服务器/客户端:
A - 没有公网IP
B - 公共 IP
C - 没有公网IP
我知道,我可以建立从 A 到 C 的 SSH 连接,如下所示:
1) 将 C 挂接到 B。从 C 开始:
ssh -R 10100:localhost:22 B_IP
2) 使用 B 挂钩设置从 A 到 C 的端口转发,以便能够在机器 A 上使用 ssh-agent:
ssh -L 5000:localhost:10100 B_IP
3) 现在我可以使用我的 ssh 密钥从 A“直接”访问 C:
ssh -p 5000 localhost
……我的观点是:
我能否以某种方式建立从 A 到 C 的新“纯”连接,以便在机器 B 停机后,我可以继续我的工作?
我认为只要这两台计算机意识到它们已经共享连接就应该是可能的,还是我错了?
感谢您的时间和想法:)