You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently we rely solely on the node logging to a file. This script then reads that file and does its thing. However, that has a feew downsides.
I want to have blockperf be able to read from systemds journal. So that a node does not need to log to a file on the fs but use journald for that. That has some benefits:
The node operator can plug the node easier into his "log aggregation" setup
The logfile can not fill up the diskspace (... more or less)
For blockperf its simpler to read the stream from systemd then to do that "rotating logfile tail"...
Below: is a python implementation of the cli command journalctl -fu cardano-node
#!/usr/bin/env python3importsysfromdatetimeimportdatetime
try:
fromsystemdimportjournalexceptImportError:
sys.stdout.write(
"This script needs python3-systemd package.\n""e.g.: https://github.com/systemd/python-systemd\n\n"
)
defmain():
# Open a Reader to connect to journaldjr=journal.Reader()
# Specify a matcher, like -u in journalctljr.add_match(_SYSTEMD_UNIT="cardano-node.service")
# We want everything there isjr.log_level(journal.LOG_DEBUG)
# move to the endjr.seek_realtime(datetime.now())
whileTrue:
# wait blocks until there is some new event in the readerevent=jr.wait()
# Events can be of various kinds, we only want the ones that add stuffifevent==journal.APPEND:
# the reader is a generator of entries, give me all of them in a loopforentryinjr:
# the entry has different fields (mostly journald specific)# MESSAGE is what was loggedprint(entry["MESSAGE"])
if__name__=='__main__':
main()
The text was updated successfully, but these errors were encountered:
Currently we rely solely on the node logging to a file. This script then reads that file and does its thing. However, that has a feew downsides.
I want to have blockperf be able to read from systemds journal. So that a node does not need to log to a file on the fs but use journald for that. That has some benefits:
Below: is a python implementation of the cli command
journalctl -fu cardano-node
The text was updated successfully, but these errors were encountered: