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

Logs should have a common patern #77

Open
endersonmaia opened this issue Feb 24, 2022 · 0 comments
Open

Logs should have a common patern #77

endersonmaia opened this issue Feb 24, 2022 · 0 comments

Comments

@endersonmaia
Copy link
Contributor

The current logs are not following a pattern.

They start with JSON, which is nice.

{"level":"info","ts":1645719468.362505,"logger":"cmd","msg":"Go Version: go1.13.3"}
{"level":"info","ts":1645719468.362529,"logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":1645719468.3625689,"logger":"cmd","msg":"Version of operator-sdk: v0.17.1"}

Then I have something like this, no more JSON:

E0224 19:34:48.369498       1 reflector.go:153] pkg/mod/k8s.io/client-go@v0.17.4/tools/cache/reflector.go:105: Failed to list *v1alpha1.Postgres: postgres.db.movetokube.com is forbidden: User "system:serviceaccount:kube-system:ext-postgres-operator" cannot list resource "postgres" in API 
E0224 19:34:49.370236       1 reflector.go:153] pkg/mod/k8s.io/client-go@v0.17.4/tools/cache/reflector.go:105: Failed to list *unstructured.Unstructured: postgres.db.movetokube.com is forbidden: User "system:serviceaccount:kube-system:ext-postgres-operator" cannot list resource "postgres"
E0224 19:34:49.370302       1 reflector.go:153] pkg/mod/k8s.io/client-go@v0.17.4/tools/cache/reflector.go:105: Failed to list *unstructured.Unstructured: postgresusers.db.movetokube.com is forbidden: User "system:serviceaccount:kube-system:ext-postgres-operator" cannot list resource "post

And when I get some error to connect to the database, I get this in two lines:

2022/02/24 19:00:15 failed to connect to PostgreSQL server: parse postgresql://postgres:z6fxajZydUO6,x9QN=Hn=K-sdPsE^X@__REDACTED__/postgres?ssl=required                                                                                    
: net/url: invalid control character in URL                                                                                                                                                                                                                                                      

Proposal

Select a pattern and sitck to it.

You could go with JSON, that's easy to parse if anyone needs to make some processing before sending the logs somewhere.

If I may suggest, I'd go with something like logfmt.

See:

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

No branches or pull requests

1 participant