Comments (6)
Hi,
the specification you linked is for request logs only. There is a similar file for logs written by the application. However, the property custom_fields
is not contained in either of those. This is due to its special nature. custom_fields
is supposed to hold a map of key-value pairs. Values are expected to be strings. If you use custom fields without registration, they are intentionally put on the root level. Custom fields is a special feature to allow specialised parsing of the fields in this structure.
Best Regards,
Karsten
from cf-nodejs-logging-support.
Thanks Karsten,
-
I'd suggest adding them to the specification so that it is the ultimate source of truth regarding what a log entry would contain. The library will still be compliant. So, you say the values of the properties in the
custom_fields
should always be strings (also #12 seems related)? It would be useful to be documented in the spec as someone may need numeric data in there. -
What are the use cases of the properties being added on root level? If it is documented somewhere, this would also help. Are these also always converted to strings? What will happen if an application uses a property whose name is the same as a standard property (by standard property I mean a property defined in the spec)? Which one will be present in the logs?
And, in general, when to use which of these 2 features? I mean if I can take any property to root level, why would I need to use custom_fields
?
Many thanks
Petar
from cf-nodejs-logging-support.
I will update the specification to reflect the current state.
I can understand, that the custom fields feature seems somewhat strange at a first glance. It was design with the Application Logging Service in SAP CloudPlatform CloudFoundry as the target system in mind. This Service restricts field at root level to those mentioned in the specification. You can add other fields, but they will not be indexed by the Log Parser of that Service. However, this service will index arbitrary key-value pairs under custom_fields
, interpreting all values as strings. This library tries to smoothen this difference by providing a unified approach when generating log messages. There is no difference between root level and custom fields when emitting a log message. For this to be possible the registration of custom fields when creating the log context was introduced.
from cf-nodejs-logging-support.
Thanks Karsten,
- If the additional properties on root level are not indexed, can they be of any use?
- Does it make sense to remove them from the output (and just stick to the
custom_fields
property)? If not, then in what situations should the root-level props be used?
Thanks again
Petar
from cf-nodejs-logging-support.
Additional properties on root level can be of use when the logs are sent to other logging services, that have different parsing. This includes our Cloud Logging Service. By default all fields registered as common fields are removed from the root level. For compatibility reasons it is possible to retain a custom field also on root level. This comes in handy when a former custom field is "promoted" to root level, as it was done with tenant_id
.
from cf-nodejs-logging-support.
Thanks for the info
from cf-nodejs-logging-support.
Related Issues (20)
- Array with stacktrace is stringified and resulting JSON is incorrect HOT 3
- Removing unnecessary logs HOT 3
- Avoid publishing dev folders like docs & tools HOT 5
- Mend reports for jsonwebtoken-8.5.1 please consider upgrade jsonwebtoken to ^9.0.0 HOT 1
- Possible vulnerability due to missing JWT public key type check
- logMessage is not using the customFields in v7 HOT 2
- CorrelationId not set when creating Child Logger HOT 4
- Fastify support HOT 15
- Winston Support in v7 HOT 3
- Custom fields always converted to strings, even if not necessary.
- custom fields are not logged correctly for request logger HOT 1
- cf-nodejs-logging-support and @sap/logging HOT 4
- using req. context logger in qunit test with nock
- tenant_id still missing in the request logger HOT 3
- ReferenceError: defaultConfig is not defined HOT 1
- Switch off the INFO log on KIBANA HOT 1
- Switch logLevel HOT 3
- Clear (my) confusion: cf-nodejs-logging-support vs @sap/logging HOT 7
- Logs contain incorrect url in "request" field HOT 2
- Extraction of logging level fails with window object HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cf-nodejs-logging-support.