-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Description
seek(:tail) does not work. It does not return the last entry in the journal. For example, run this script:
require 'systemd/journal'
require 'time'
now = Time.now
j = Systemd::Journal.new(path: '/var/log/journal')
j.seek(:tail)
if rc = j.move_next
puts "how is it possible to move_next from the tail"
end
diff = now - j.current_entry.realtime_timestamp
puts "journal tail is #{diff} seconds or #{diff/86400} days behind now"
count = 1
while rc
rc = j.move_next
count = count + 1
end
diff = now - j.current_entry.realtime_timestamp
puts "we finally got to the tail after #{count} entries - time #{j.current_entry.realtime_timestamp} - last entry is #{diff} seconds behind now"
On my Fedora 24 system, I get the following output:
how is it possible to move_next from the tail
journal tail is 7957356.183605957 seconds or 92.09902990284672 days behind now
we finally got to the tail after 39 entries - time 2017-01-06 15:28:12 -0700 - last entry is 80.451257957 seconds behind now
That is, when doing seek(:tail), it is really 39 entries behind the actual tail.
Compare this to the behavior of journalctl -f which returns the last entry
Metadata
Metadata
Assignees
Labels
No labels