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

Standardized logging #105

Open
fawadasaurus opened this issue Jan 12, 2023 · 3 comments
Open

Standardized logging #105

fawadasaurus opened this issue Jan 12, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@fawadasaurus
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Different interfaces/logs have different log formats and contents.

Propose a solution

Log formats should be standardized. Ideally they would use json so they can be machine parsed with grok/regex.

Describe alternatives you've considered

None

Additional context

None

@fawadasaurus fawadasaurus added enhancement New feature or request triage To be triaged labels Jan 12, 2023
@pkedy
Copy link
Contributor

pkedy commented Jan 12, 2023

NanoBus already uses uber-go/zap, which is a structured logger. What you are asking for is to be able to change the logger configuration for production instead of only development.

@jsoverson
Copy link
Contributor

Different interfaces/logs have different log formats and contents.

Can you list the spots where logging is different? There was an issue with the HTTP static server but that's been fixed AFAIK.

@fawadasaurus
Copy link
Contributor Author

fawadasaurus commented Jan 19, 2023

https://github.com/nanobus/nanobus/search?q=println

All of these are effectively log entries that need to be in the standard format.

Again, I believe that all logs should be in JSON format so we can have different message payloads based on the specific use case. For example the HTTP server message can be an access log line where as other service message can have their own types of messages.

{log_level: <INFO>, trace_id: <traceid>, time: <timestamp>, tenant_id: <abc123>, app_name: <myapp>, app_version: <0.0.1>, component: <nanobus.transport.http.static/v1>, message: "'{'
    '"time_local":"$time_local",'
    '"remote_addr":"$remote_addr",'
    '"remote_user":"$remote_user",'
    '"request":"$request",'
    '"status": "$status",'
    '"body_bytes_sent":"$body_bytes_sent",'
    '"request_time":"$request_time",'
    '"http_referrer":"$http_referer",'
    '"http_user_agent":"$http_user_agent"'
  '}'"

This way, a standard NanoBus log has a certain schema that must always include certain information. Each component must define its own log format that can be parsed without regex/pattern matching.

@jsoverson jsoverson removed the triage To be triaged label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants