Skip to content

Conversation

MauriceVanVeen
Copy link
Member

@MauriceVanVeen MauriceVanVeen commented Jul 17, 2025

Include client's account and user in any logs specific to a client connection, for example:

cid:5 - maximum account active connections exceeded - Account: $G - User "test-user"

If many connections are created for the same account and above error is triggered, we now also rate-limit these logs (per account).

If there is an authentication error, the account will not be known, in that case only the user is logged.

cid:5 - authentication error - User "test-user"

Resolves #4596

Signed-off-by: Maurice van Veen github@mauricevanveen.com

@MauriceVanVeen MauriceVanVeen requested a review from a team as a code owner July 17, 2025 21:55
@MauriceVanVeen MauriceVanVeen force-pushed the maurice/client-log-account branch from 61068c8 to 1bdb453 Compare July 17, 2025 21:58
@alexbozhenko
Copy link
Contributor

@MauriceVanVeen would it be possible to also include the user in the log line?

@MauriceVanVeen
Copy link
Member Author

@MauriceVanVeen would it be possible to also include the user in the log line?

Will add, would also resolve #4596

@MauriceVanVeen MauriceVanVeen changed the title (2.12) [IMPROVED] Add account to client log (2.12) [IMPROVED] Add account and user to client log Jul 21, 2025
@MauriceVanVeen MauriceVanVeen force-pushed the maurice/client-log-account branch 2 times, most recently from cd4303b to ea61352 Compare July 21, 2025 08:24
@alexbozhenko
Copy link
Contributor

@MauriceVanVeen could you please rebase and let's merge it?

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
@MauriceVanVeen MauriceVanVeen force-pushed the maurice/client-log-account branch from ea61352 to 3af2c6c Compare August 14, 2025 22:50
Copy link
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

LGTM

@neilalexander neilalexander merged commit 06e97c0 into main Aug 15, 2025
69 of 70 checks passed
@neilalexander neilalexander deleted the maurice/client-log-account branch August 15, 2025 15:37
neilalexander added a commit that referenced this pull request Aug 19, 2025
Since #7079 we have more
detailed logging for clients. However, if the client was internal and
had no string representation, it would log the following:
```
[WRN]  - Invalid JetStream request '$G > $JS.API.STREAM.INFO.test-stream': <error>
```

The `" - "` prefix was due to this logging. This PR fixes that by not
including it in this case.

Signed-off-by: Maurice van Veen <github@mauricevanveen.com>
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.

Log client names on disconnect messages
3 participants