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

Allow custom naming for default fields #4

Open
nihonjinrxs opened this issue Sep 22, 2018 · 4 comments
Open

Allow custom naming for default fields #4

nihonjinrxs opened this issue Sep 22, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@nihonjinrxs
Copy link

In order to allow for conformance to a corporate logging standard, it would be helpful to allow renaming the default log fields in a configuration block of some sort.

For example, Usually, I need to write log_lvl with the key level and log_msg with the key msg. While I can do that now by adding those keys at the end, it seems I'll I end up having extra keys I don't use.

@ryapric ryapric added the enhancement New feature or request label Sep 24, 2018
@ryapric
Copy link
Owner

ryapric commented Sep 24, 2018

The challenge with this, is that many functions currently depend on those field names being the defaults, as well as those function's arguments. Depending on your deployment scenario, though, you don't need to add new fields; you can just replace the fields, e.g. even at a native level with sed:

sed -i 's/log_lvl/level/g' loggit.json

Obviously not as robust when you want to write to a stream connection, but that's a quick fix for when using it the default way. Adding to enhancements list regardless.

@nihonjinrxs
Copy link
Author

We stream logs to stdout of the container, and container log streams are piped to a logstash instance, so would be really nice not to have to munge things after the fact. Thanks for adding this to the enhancements list.

@ryapric ryapric added this to the v2 milestone Mar 15, 2020
@ryapric
Copy link
Owner

ryapric commented Mar 15, 2020

Update that I'm still not super sure about this one, but will explore as I work on v2.0.0. Maybe just add a function arg to rename before output. It would put a lot of onus on the developer to maintain naming consistency, though, and there's a fine line between flexibility and shared-responsibility. But, will keep open for now.

@ryapric ryapric removed this from the v2 milestone May 4, 2020
@ryapric
Copy link
Owner

ryapric commented May 4, 2020

Removing from v.2.0.0 milestone (but keeping open for others) due to complexity, and use-case dependence. The solution provided earlier is the best bet for now, despite it creating extra redundant keys:

For example, Usually, I need to write log_lvl with the key level and log_msg with the key msg. While I can do that now by adding those keys at the end, it seems I'll I end up having extra keys I don't use.

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

2 participants