如何在 journalctl 之外分析 journalctl 日志?
How do I analyze journalctl logs outside of journalctl?
我需要从我的 systemd 日志文件中收集一些统计信息,比如有多少用户将某个查询字符串参数传递到我的服务。我知道我可以在 journalctl 中查看此信息,但我无法弄清楚如何在 Go 中这样做以便我可以聚合数据。我一直在为此寻找一个库,但似乎找不到任何东西,而且我无法弄清楚日志文件的实际存储位置。
您可以通过以下项目获得一些线索:
ChimeraCoder/journalctl-go
eparis/access-daemon
chrissnell/kube-journald-filter
which uses coreos/go-systemd/
sdjournal
package, with a Journal class following the fields of an actual journal.
见 test class journal_test.go
.
或者您可以直接将其转发到外部系统日志,如 pmorton/journalfwd
。
我需要从我的 systemd 日志文件中收集一些统计信息,比如有多少用户将某个查询字符串参数传递到我的服务。我知道我可以在 journalctl 中查看此信息,但我无法弄清楚如何在 Go 中这样做以便我可以聚合数据。我一直在为此寻找一个库,但似乎找不到任何东西,而且我无法弄清楚日志文件的实际存储位置。
您可以通过以下项目获得一些线索:
ChimeraCoder/journalctl-go
eparis/access-daemon
chrissnell/kube-journald-filter
which usescoreos/go-systemd/
sdjournal
package, with a Journal class following the fields of an actual journal.
见 test classjournal_test.go
.
或者您可以直接将其转发到外部系统日志,如 pmorton/journalfwd
。