Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix newlog: move temp log files correctly after reboot #4476

Merged

Conversation

europaul
Copy link
Contributor

Upon reboot newlogd moves the temporary log files from the collect directory to different directories based on the log file type. Before all log files were moved to upload direcroties. This change add the logic to move the log files to the correct directories based on the file name and (possibly) the available domain configs (for app logs).

Upon reboot newlogd moves the temporary log files from the collect
directory to different directories based on the log file type. Before
all log files were moved to upload direcroties. This change add the
logic to move the log files to the correct directories based on the
file name and (possibly) the available domain configs (for app logs).

Signed-off-by: Paul Gaiduk <[email protected]>
Also removed duplicate lines from excludes.txt.
Also removed .yetus-excludes file because it's not used. Yetus uses
.yetus/excludes.txt instead.

Signed-off-by: Paul Gaiduk <[email protected]>
@europaul
Copy link
Contributor Author

@shjala could you take a look at 9eb1067 and make sure I didn't remove anything useful?

@shjala
Copy link
Member

shjala commented Dec 12, 2024

@shjala could you take a look at 9eb1067 and make sure I didn't remove anything useful?

all good, but why it is part of this PR?

// this is going to be executed right after bootup, so the availability of config for this app is subject to race condition
// furthermore the config might not contain the appUUID anymore, so we are better off uploading the logs as default
appuuid := getAppuuidFromLogfile(fileinfo)
if val, found := domainUUID.Load(appuuid); found {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it available after the reboot? Or it's not a problem if it is not?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That depends if the domainconfig is available through pubsub already. For this zedagent needs to get device config, parse it, inform zedmanager, which needs to inform domainmanager. So I guess it's unlikely all this happens before newlogd starts :)
That's why we also set a default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, there is no race between "stored" and a default value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if "stored" value (coming from domainConfig) is not accessible - newlogd will take the default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the race is between how fast newlogd gets to this piece of code vs how quickly domainConfig becomes available through pubsub

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, could it be a problem if we set the default value and ignore the real value (because of the race)? Am I right that even if it happens, we still wouldn't lose any logs that haven't been uploaded?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, logs will be not lost for sure. The only "erroneous" behavior would be that we upload app logs that shouldn't be uploaded. But I figured it's better than not uploading some logs that are actually expected on the controller side.

@europaul
Copy link
Contributor Author

all good, but why it is part of this PR?

Because yetus was complaining about the content of testdata directory

Copy link
Member

@OhmSpectator OhmSpectator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's run the tests

@OhmSpectator OhmSpectator self-requested a review December 13, 2024 14:58
@OhmSpectator OhmSpectator merged commit 2e69dc3 into lf-edge:master Dec 13, 2024
79 of 92 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants