-
Notifications
You must be signed in to change notification settings - Fork 164
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
fix newlog: move temp log files correctly after reboot #4476
Conversation
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]>
// 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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Because yetus was complaining about the content of |
There was a problem hiding this 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
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).