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

fix: exclude hostname from clay-log json #35

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Conversation

ealcantara22
Copy link
Member

@ealcantara22 ealcantara22 commented Oct 23, 2024

In some use cases, we do not want the application to ship logs with the "hostname" field populated as it can create conflict with other tools. For example, if present Datadog is forced to drop any host-related tags such as cluster name, etc. difficulting some filter capabilities.

see: DataDog/datadog-agent#14860

// default
let myLogger = init({ name: 'my-logger' });
myLogger('info', 'message text');
{"level":30,"time":1729715181162,"msg":"message text","pid":34323,"hostname":"MBP14M2.local","name":"my-logger","_label":"INFO","v":1}
// excluding the hostname
let myLogger = init({ name: 'my-logger', omitHost: true });
myLogger('info', 'message text');
{"level":30,"time":1729715193235,"msg":"message text","pid":34330,"name":"my-logger","_label":"INFO","v":1}

@ealcantara22 ealcantara22 self-assigned this Oct 23, 2024
@ealcantara22 ealcantara22 changed the title feat: exclude hostname from clay-log json fix: exclude hostname from clay-log json Oct 23, 2024
Copy link
Member

@james-owen james-owen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. just took a look at the oddly named base option for pino https://getpino.io/#/docs/api?id=base-object

@ealcantara22 ealcantara22 merged commit 6b3da27 into master Oct 24, 2024
2 checks passed
@ealcantara22 ealcantara22 deleted the omit-hostname branch October 24, 2024 16:35
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

Successfully merging this pull request may close these issues.

2 participants