keria icon indicating copy to clipboard operation
keria copied to clipboard

KERIA logs should indicate the agent that the log applies to

Open 2byrds opened this issue 1 year ago • 7 comments

Feature request description/rationale

Currently there is no distinction between logs per agent. Prefix the logs with the agent id.

2byrds avatar Nov 21 '24 13:11 2byrds

It would be useful if the log format was standardized throughout as well. Maybe to take inspiration from https://en.wikipedia.org/wiki/Common_Log_Format.

If we add the controller id and/or agent id, and then log every request, it would be much easier to track down certain errors.

lenkan avatar Nov 27 '24 14:11 lenkan

From our dev meeting, the keri logging has advanced log features to add additional fields, for instance different formatters. There might be some witness examples with formatters.

2byrds avatar Dec 03 '24 15:12 2byrds

Look in keripy help.tests.help.oggler class definition for examples. There is some hio compatible logger stuff. you can change the f-strings. Phil showed the example: image It is recommended to put the agent information in a f-string The log module source is through hio, but keri import should be from help.

2byrds avatar Dec 03 '24 15:12 2byrds

From Sam during the meeting: "ogler = ogling.initOgler(prefix='keri', syslogged=False) # inits once only on first import This is in keri.help.init.py so import ogler from keri.help to get prefix of 'keri' To get a module specific prefix then import ogling from keri.help and then create a module specific ogler with a different prefix. The reason not to import ogler from hio is so that any keri specific configuration can happen in keri.help and all keri submodules inherit that behavior."

2byrds avatar Dec 03 '24 15:12 2byrds

From our vLEI-dev-community call: Ed E. noted that that GDPR could be an issue if the logs are stored indefinitely, etc. because of identifier ids/name/creds. @kentbull sent us his recent manual log changes. Hopefully he can review the above and note to us if the Ogler suggestion from Sam can work within KERIA, per agent. Kent three logging PRs are: To the v1.1.30 branch: https://github.com/WebOfTrust/keripy/pull/930/files To the v1.2.4 branch: https://github.com/WebOfTrust/keripy/pull/932 To main: https://github.com/WebOfTrust/keripy/pull/933 We took a look and like the additional logging information, but would like to explore agent specific logging that includes the prefix without the need to include it manually, etc.

2byrds avatar Jan 30 '25 16:01 2byrds

At HP for both security and privacy reasons we had to scrub logs of all identifiers like usernames. So while its helpful for debugging including full identifiers might result in a lot of work down the road. You might consider truncating the identifiers, to something like first 4 and last 4 characters.

SmithSamuelM avatar Jan 30 '25 19:01 SmithSamuelM

@SmithSamuelM yes, I truncated the identifiers to the first 8 characters, though using the first 4 and last 4 would be even better. I will change my logging PRs to reflect this.

kentbull avatar Jan 30 '25 20:01 kentbull