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

Log the context #112

Open
spolischook opened this issue Jul 4, 2022 · 2 comments
Open

Log the context #112

spolischook opened this issue Jul 4, 2022 · 2 comments

Comments

@spolischook
Copy link

🚀Log the context

Description: There are many different contexts that we need to log along with basic log message

### Issue with current implementation 

At BajaBikes, we used glg to log app executions in many different contexts:
- User, admin, demon execution processes
- lambda, cube, local 
- dev, staging, production
Some of that contexts, e.g. last one, could implemented by separate logging endpoints and\or writers
But others should be added to log as part of the logging.  
E.g. [Elastic Common Schema (ECS)](https://www.elastic.co/guide/en/ecs/current/index.html) 
has a rich schema that can complete log context in many ways. 

### Applicable Solution

Use json format only for one (LogstashWriter) writer  
In writer before send our logs we can Unmarshal log, add contexts and then Marshal it back.  
We can use json format only for all writers all together, that is not trully readable (e.g. for a console)

Another solution will be allow add context to log somehow, or allow define custom structure for a logs,  
but I can't imagine an implementation for now.

### Alternative solution

For now, we are using text format, that we parse in writer by regular expresion, complete structure with contexts, 
marshal it and send to the logstash. 
It's fine for now, but maybe you can get sugestions to make more powerful architecture
@kpango
Copy link
Owner

kpango commented Jul 6, 2022

@spolischook Am I correct that you want to display console logs in Raw format as currently, but allow logging in JSON format for certain Writers?

@spolischook
Copy link
Author

@spolischook Am I correct that you want to display console logs in Raw format as currently, but allow logging in JSON format for certain Writers?

that's right. in that case parsing logs will be much easier task

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

2 participants