-
Notifications
You must be signed in to change notification settings - Fork 376
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
tetragon: cache username lookups #2448
Conversation
c4dc849
to
9b4446c
Compare
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.
Thanks, overall looks good to me. I've left some minor comments.
if userInfo, err := user.LookupId(strconv.FormatUint(uint64(m.Unix.Process.UID), 10)); err == nil { | ||
m.Unix.Process.User.Name = userInfo.Name | ||
if username, err := userdb.UsersCache.LookupUser(m.Unix.Process.UID); err == nil { | ||
m.Unix.Process.User.Name = username |
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.
would be nice to have a metric here for errors.
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.
Will do it separately, thanks
@tixxdz lookgs good, few questions could you please provide more details in changelogs on why we want to do that, I guess it's faster, can we measure that? thanks |
Cache UIDs/Usernames so we reduce: - I/O on /etc/passwd for each execution especially for root user and other system user IDs as by default lot of software runs under those. - Some users may watch /etc/passwd access, so caching those entries will reduce Tetragon generated events and improve performance overall. We only cache UIDs from 0..999 as these are considered standard system users, that are set by most distros packages. Distros maintainers usually do great job to not clash such users. For anything above > 999 we do not cache it, we can that if users want such support later. Reference: https://github.com/systemd/systemd/blob/main/docs/UIDS-GIDS.md#summary Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
Signed-off-by: Djalal Harouni <tixxdz@gmail.com>
I added the following commit logs:
Thank you |
9b4446c
to
79aefef
Compare
No description provided.