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

Added fields to ACL LOG error entries for precise time logging #11477

Merged
merged 4 commits into from Feb 2, 2023

Conversation

roshkhatri
Copy link
Collaborator

@roshkhatri roshkhatri commented Nov 4, 2022

Added 3 fields to the ACL LOG - adds entry_id, timestamp_created and timestamp_last_updated, which updates similar existing log error entries. The pair - entry_id, timestamp_created is a unique identifier of this entry, in case the node dies and is restarted, it can detect that if it's a new series.

The primary use case of Unique id is to uniquely identify the error messages and not to detect if the server has restarted.

  1. entry-id is the sequence number of the entry (starting at 0) since the server process started. Can also be used to check if items were "lost" if they fell between periods.
  2. timestamp-created is the unix-time in ms at the time the entry was first created.
  3. timestamp-last-updated is the unix-time in ms at the time the entry was last updated

Time_created gives the absolute time which better accounts for network time as compared to time since. It can also be older than 60 secs and presently there is no field that can display the original time of creation once the error entry is updated.
The reason of timestamp_last_updated field is that it provides a more precise value for the “last time” an error was seen where as, presently it is only in the 60 second period.

Changes in acl.c: adds entry_id, timestamp_created and timestamp_last_updated to ACL LOG.

Changes in acl.tcl: adds test that verify that all of the additional fields are available in the reply when the ACL LOG commands and verifies that timestamp_created does not change when log entry is updated and that timestamp-last-updated is updated when entry is updated. Also checks if a new unique id is assigned to a new task.

Release notes
Add entry id, timestamp created, and timestamp last updated time to ACL log entries.

@oranagra
Copy link
Member

oranagra commented Nov 6, 2022

I'd like to learn more about the use case and justification for this.
A unique ID doesn't necessarily help you detect that the server was restarted, but there's an INFO field that can do that (run_id), combining that with a creation time would do, but now it looks a bit odd to have 3 time values in the output (last update and age, which are actually the same, and a creation time, which can't be older than 60 seconds, see ACL_LOG_GROUPING_MAX_TIME_DELTA).

@roshkhatri roshkhatri closed this Nov 7, 2022
@roshkhatri roshkhatri reopened this Nov 7, 2022
@roshkhatri roshkhatri changed the title Added fields to ACL LOG error entries for unique IDs Added fields to ACL LOG error entries for precise time logging Nov 7, 2022
@madolson
Copy link
Contributor

madolson commented Nov 8, 2022

This is a commit from AWS fyi. @oranagra I think @roshkhatri updated the commit with more information.

@madolson
Copy link
Contributor

@redis/core-team We added these fields internally to better track ACL log records. Thoughts on exposing them?

@madolson madolson added state:major-decision Requires core team consensus approval-needed Waiting for core team approval to be merged labels Nov 16, 2022
@madolson madolson requested a review from yossigo December 7, 2022 15:53
@madolson
Copy link
Contributor

madolson commented Dec 7, 2022

Reviewed in core meeting. Summary was that we "OK" with adding more fields, but really want to understand if they are necessary. @yossigo will take a second look to validate we aren't missing anything.

@roshkhatri
Copy link
Collaborator Author

Thank you so much for the update! Looking forward to @yossigo's review.

@roshkhatri
Copy link
Collaborator Author

Hey @yossigo, Please take a look at these changes so we can validate if we aren't leaving out anything, Thank You!

Copy link
Member

@yossigo yossigo left a comment

Choose a reason for hiding this comment

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

LGTM. I agree with @oranagra that having three time fields is suboptimal, but I think it's a reasonable compromise.

@madolson madolson added the state:needs-doc-pr requires a PR to redis-doc repository label Feb 2, 2023
@madolson
Copy link
Contributor

madolson commented Feb 2, 2023

Cool, let's update the docs and we can close this. We previously reviewed this in the core meeting, and were just waiting on Yossi.

@roshkhatri
Copy link
Collaborator Author

Sounds good. Updating the docs now.

@madolson madolson added the release-notes indication that this issue needs to be mentioned in the release notes label Feb 2, 2023
madolson added a commit to redis/redis-doc that referenced this pull request Feb 2, 2023
Updating the doc for the changes made in redis/redis#11477.

Added description for the ACL LOG fields.
@madolson madolson merged commit ac31295 into redis:unstable Feb 2, 2023
enjoy-binbin added a commit to enjoy-binbin/redis that referenced this pull request Feb 3, 2023
There is a timing issue in the new ACL log test:
```
*** [err]: ACL LOG aggregates similar errors together and assigns unique entry-id to new errors in tests/unit/acl.tcl
Expected 1675382873989 < 1675382873989 (context: type eval line 15 cmd {assert {$timestamp_last_update_original < $timestamp_last_updated_after_update}} proc ::test)
```

Looking at the test code, we will check the `timestamp-last-updated` before
and after a new ACL error occurs. Actually `WRONGPASS` errors can be executed
very quickly on fast machines. For example, in the this case, the execution is
completed within one millisecond.

The error is easy to reproduce, if we reduce the number of the for loops, for
example set to 2, and using --loop and --stop. Avoid this timing issue by adding
an `after 1` before the new errors.

The test was introduced in redis#11477.
oranagra pushed a commit that referenced this pull request Feb 3, 2023
There is a timing issue in the new ACL log test:
```
*** [err]: ACL LOG aggregates similar errors together and assigns unique entry-id to new errors in tests/unit/acl.tcl
Expected 1675382873989 < 1675382873989 (context: type eval line 15 cmd {assert {$timestamp_last_update_original < $timestamp_last_updated_after_update}} proc ::test)
```

Looking at the test code, we will check the `timestamp-last-updated` before
and after a new ACL error occurs. Actually `WRONGPASS` errors can be executed
very quickly on fast machines. For example, in the this case, the execution is
completed within one millisecond.

The error is easy to reproduce, if we reduce the number of the for loops, for
example set to 2, and using --loop and --stop. Avoid this timing issue by adding
an `after 1` before the new errors.

The test was introduced in #11477.
@roshkhatri roshkhatri deleted the acl-error-aggregation branch March 11, 2023 21:30
Mixficsol pushed a commit to Mixficsol/redis that referenced this pull request Apr 12, 2023
…#11477)

Added 3 fields to the ACL LOG - adds entry_id, timestamp_created and timestamp_last_updated, which updates similar existing log error entries. The pair - entry_id, timestamp_created is a unique identifier of this entry, in case the node dies and is restarted, it can detect that if it's a new series.

The primary use case of Unique id is to uniquely identify the error messages and not to detect if the server has restarted.

entry-id is the sequence number of the entry (starting at 0) since the server process started. Can also be used to check if items were "lost" if they fell between periods.
timestamp-created is the unix-time in ms at the time the entry was first created.
timestamp-last-updated is the unix-time in ms at the time the entry was last updated
Time_created gives the absolute time which better accounts for network time as compared to time since. It can also be older than 60 secs and presently there is no field that can display the original time of creation once the error entry is updated.
The reason of timestamp_last_updated field is that it provides a more precise value for the “last time” an error was seen where as, presently it is only in the 60 second period.

Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
Mixficsol pushed a commit to Mixficsol/redis that referenced this pull request Apr 12, 2023
There is a timing issue in the new ACL log test:
```
*** [err]: ACL LOG aggregates similar errors together and assigns unique entry-id to new errors in tests/unit/acl.tcl
Expected 1675382873989 < 1675382873989 (context: type eval line 15 cmd {assert {$timestamp_last_update_original < $timestamp_last_updated_after_update}} proc ::test)
```

Looking at the test code, we will check the `timestamp-last-updated` before
and after a new ACL error occurs. Actually `WRONGPASS` errors can be executed
very quickly on fast machines. For example, in the this case, the execution is
completed within one millisecond.

The error is easy to reproduce, if we reduce the number of the for loops, for
example set to 2, and using --loop and --stop. Avoid this timing issue by adding
an `after 1` before the new errors.

The test was introduced in redis#11477.
enjoy-binbin pushed a commit to enjoy-binbin/redis that referenced this pull request Jul 31, 2023
…#11477)

Added 3 fields to the ACL LOG - adds entry_id, timestamp_created and timestamp_last_updated, which updates similar existing log error entries. The pair - entry_id, timestamp_created is a unique identifier of this entry, in case the node dies and is restarted, it can detect that if it's a new series.

The primary use case of Unique id is to uniquely identify the error messages and not to detect if the server has restarted.

entry-id is the sequence number of the entry (starting at 0) since the server process started. Can also be used to check if items were "lost" if they fell between periods.
timestamp-created is the unix-time in ms at the time the entry was first created.
timestamp-last-updated is the unix-time in ms at the time the entry was last updated
Time_created gives the absolute time which better accounts for network time as compared to time since. It can also be older than 60 secs and presently there is no field that can display the original time of creation once the error entry is updated.
The reason of timestamp_last_updated field is that it provides a more precise value for the “last time” an error was seen where as, presently it is only in the 60 second period.

Co-authored-by: Madelyn Olson <madelyneolson@gmail.com>
enjoy-binbin added a commit to enjoy-binbin/redis that referenced this pull request Jul 31, 2023
There is a timing issue in the new ACL log test:
```
*** [err]: ACL LOG aggregates similar errors together and assigns unique entry-id to new errors in tests/unit/acl.tcl
Expected 1675382873989 < 1675382873989 (context: type eval line 15 cmd {assert {$timestamp_last_update_original < $timestamp_last_updated_after_update}} proc ::test)
```

Looking at the test code, we will check the `timestamp-last-updated` before
and after a new ACL error occurs. Actually `WRONGPASS` errors can be executed
very quickly on fast machines. For example, in the this case, the execution is
completed within one millisecond.

The error is easy to reproduce, if we reduce the number of the for loops, for
example set to 2, and using --loop and --stop. Avoid this timing issue by adding
an `after 1` before the new errors.

The test was introduced in redis#11477.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approval-needed Waiting for core team approval to be merged release-notes indication that this issue needs to be mentioned in the release notes state:major-decision Requires core team consensus state:needs-doc-pr requires a PR to redis-doc repository
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants