Skip to content

journalctl: don't skip the duplicate entries for avoiding missing logs - #17926

Merged
poettering merged 1 commit into
systemd:masterfrom
syyhao1994:dev1210
Dec 15, 2020
Merged

poettering merged 1 commit into
systemd:masterfrom
syyhao1994:dev1210

Conversation

@syyhao1994

Copy link
Copy Markdown
Contributor

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.

@poettering

Copy link
Copy Markdown
Member

Can you provide an example where this became a problem?

@poettering poettering added journal needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer labels Dec 10, 2020
@syyhao1994

Copy link
Copy Markdown
Contributor Author

ere this became a problem?

#17540
As i said in the issue listed above, some continues logs may missing at the joints of two [email protected]. I think this problem only happens at the joints of two journal files because
this pr:eworm-de@2867dfb.
I encountered this problem because i inject 10 times mce mistakes but i got only 9 maybe 7 mistakes by collecting from journaclt. So i made the reproducing method metioned in the issue.

@poettering

Copy link
Copy Markdown
Member

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?

@syyhao1994

Copy link
Copy Markdown
Contributor Author

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.

@poettering

Copy link
Copy Markdown
Member

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?

@syyhao1994

syyhao1994 commented Dec 10, 2020 •

Copy link
Copy Markdown
Contributor Author

missing_logs1

The missing logs could be seen in pictrue, i think journalctl should missing so many logs that there are different sentenses between them.
@poettering

@poettering

Copy link
Copy Markdown
Member

please provide me with the minimal set of .journal files that cause this

@syyhao1994

Copy link
Copy Markdown
Contributor Author

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?
This problems has nothing to do with the journald.conf.

@poettering

Copy link
Copy Markdown
Member

The former. Just the relevant .journal binary log files that have two distinct records but the same xor hash and evertyhing.

@syyhao1994

Copy link
Copy Markdown
Contributor Author

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.
Thank you for your attention.

@syyhao1994

Copy link
Copy Markdown
Contributor Author

@poettering

Copy link
Copy Markdown
Member

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:

s=191b16447622487ab6aafd56234ed07d;i=b9a4c;b=acb8babb3feb409a84c2c57eaccb0b72;m=a0b39c36;t=5b61d3f91237d;x=302a0ee2ff952880

@poettering

Copy link
Copy Markdown
Member

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.

@syyhao1994

Copy link
Copy Markdown
Contributor Author

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:

s=191b16447622487ab6aafd56234ed07d;i=b9a4c;b=acb8babb3feb409a84c2c57eaccb0b72;m=a0b39c36;t=5b61d3f91237d;x=302a0ee2ff952880

missing_logs4
missing_logs5

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.

@poettering

Copy link
Copy Markdown
Member

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?

@poettering

Copy link
Copy Markdown
Member

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

@poettering poettering added reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks and removed needs-reporter-feedback ❓ There's an unanswered question, the reporter needs to answer labels Dec 10, 2020
@syyhao1994

Copy link
Copy Markdown
Contributor Author

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

missing_logs6

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.

@syyhao1994

Copy link
Copy Markdown
Contributor Author

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

You mean seqnum should take into considering, i agree with that.
And if i and the seqnum into the code i have delete, i think it is the same to just delete it. As i thought seqnum is take into acount in the later judgement.

@syyhao1994

syyhao1994 commented Dec 10, 2020 •

Copy link
Copy Markdown
Contributor Author

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.

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.

@syyhao1994
syyhao1994 force-pushed the dev1210 branch 2 times, most recently from 16d1330 to 6e8d9d4 Compare December 11, 2020 03:25
@syyhao1994

syyhao1994 commented Dec 11, 2020 •

Copy link
Copy Markdown
Contributor Author

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 have reworked the PR, please review.
@poettering

These two judgement can't judge that two entries are repeating fully.
So i think seqnum is needed to make full judgement.
@bluca bluca added needs-review and removed reviewed/needs-rework 🔨 PR has been reviewed and needs another round of reworks labels Dec 14, 2020
@syyhao1994

Copy link
Copy Markdown
Contributor Author

So could someone review the pr please?
@vcaputo @poettering @yuwata @mrc0mmand @keszybz

@poettering

Copy link
Copy Markdown
Member

excellent! thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants