Repository navigation
journalctl: don't skip the duplicate entries for avoiding missing logs - #17926
Conversation
|
Can you provide an example where this became a problem? |
#17540 |
|
I am not sure I grok what you are saying? you managed to generate the exact same records multiple times? and believe they should be stored multiple times? why that? or did you generate separate distinct records that we misunderstood as being identical event though they weren't? |
These records are not the exact same. In my reproducer(which is only used for more easily to reproduce problem), "echo "MCE $i" , at least the first sentence is not the same every recirculation. In practicle, maybe there are some sentenses are the same(maybe 5 of 10) every recirculation. But it may misunderstood journalctl. |
|
so, they aren#t the same but our XOR hash results in the same hash value, so we misidentify them as identical? The thing is: journal files are supposed to be something you can have around redundantly, i.e. once in /run and once in /var (while things are flushed from /run into /var during boot), and we should recognize that and suppress duplicate entries. If the XOR of the jenkins hashes of the data fields is indeed too simple and misdentifies things we can look into replacing it with something better, but I thought the hash function was good enough. Any chance we can supply me with a minimal set of journal files that have two records that are misidentified as identical even though they arent? |
|
The missing logs could be seen in pictrue, i think journalctl should missing so many logs that there are different sentenses between them. |
|
please provide me with the minimal set of .journal files that cause this |
You mean the files of [email protected], or the setting of /etc/systemd/journald.conf? |
|
The former. Just the relevant .journal binary log files that have two distinct records but the same xor hash and evertyhing. |
Ok, i got it. I need to reproduce the problem, so it will take times, i will upload the file once i reproduce it. |
https://github.com/syyhao1994/files/blob/master/system%40191b16447622487ab6aafd56234ed07d-00000000000b9a4a-0005b61d3f91237d.journal |
|
In those two files which entries are considered identical but actually aren't? In the "journalctl -o verbose" output you'll see the "cursor" printed for them, can you paste thta? The "cursor" looks like this: |
|
So looking at the files there are actually some log messages generated with the exact same contents, at the very same monotonic and realtime time, which we consider the same event. They only differ in the sequence number, and we don't check for that. I am not sure what the rationale was for ignore the seqnum for these comparisons, but appears to me the right approach would be to take those also into consideration when comparing the entries. i.e. not compare less but compare more. |
The tail of system%40191b16447622487ab6aafd56234ed07d-00000000000b9a4a-0005b61d3f91237d.journal and the head of system%40191b16447622487ab6aafd56234ed07d-00000000000b9e68-0005b61d3f91dad6.journal are missing as pictures showing. I will try to figure out the entries, but i maybe a littlt difficult for me. I will try hard. |
|
what kind of system is this on btw? it sounds surprising the timestamps are all the same when this happens. we use µs granularity, which looks like it should be fine enough to increase between all loggable events. How come you have such a coarse clock? |
|
hmm, so this is a stream transport. and i guess a lot of lines that are otherwise identical are dumped at once in the stream. when journald then parses this out, it will just query the time once (i.e. use the timestamp of the event loop iteration, whcih will be the same for all log messages generated from the same data dump). So yeah, I guess the comparison should be updated to take the seqno into account |
I used the "journalctl -o verbose" command to get the picture listed above, you can see there are many logs that have the same timestamps. |
You mean seqnum should take into considering, i agree with that. |
I missed this reply, i totally agree with you. I think we should be more carefull when skipping logs. As i said, repeating is better than missing in my opinion. |
16d1330 to
6e8d9d4
Compare
I have reworked the PR, please review. |
These two judgement can't judge that two entries are repeating fully. So i think seqnum is needed to make full judgement.
|
So could someone review the pr please? |
|
excellent! thanks! |
These two judgement can't judge that two entries are repeating fully.
So i think it is better to keep the full log rather than missing logs that are not actually repeating.
The PR of eworm-de@2867dfb only solves the problem that the same entris in the same file.