diff --git a/docs/reference/index.md b/docs/reference/index.md index 3a0f904..c2a56e9 100644 --- a/docs/reference/index.md +++ b/docs/reference/index.md @@ -1,4 +1,7 @@ --- +applies_to: + stack: ga + serverless: ga mapped_pages: - https://www.elastic.co/guide/en/ecs-logging/nodejs/current/intro.html - https://www.elastic.co/guide/en/ecs-logging/nodejs/current/index.html @@ -6,7 +9,7 @@ mapped_pages: # ECS Logging Node.js [intro] -Node.js ECS loggers are formatter plugins for your favorite logging libraries. They make it easy to format your logs into ECS-compatible JSON. In combination with [filebeat](https://www.elastic.co/products/beats/filebeat) you can send your logs directly to Elasticsearch and leverage [Kibana’s Logs app](docs-content://solutions/observability/logs/explore-logs.md) to inspect all logs in one single place. +Node.js ECS loggers are formatter plugins for your favorite logging libraries. They make it easy to format your logs into ECS-compatible JSON. In combination with [filebeat](https://www.elastic.co/products/beats/filebeat) you can send your logs directly to Elasticsearch and leverage [Kibana's Logs app](docs-content://solutions/observability/logs/explore-logs.md) to inspect all logs in one single place. The Node.js ECS logging formatters log structured JSON and support serialization of Error objects and HTTP Request and Response objects from Node.js core and popular web frameworks. A minimal log record includes the following fields: @@ -30,5 +33,5 @@ Ready to jump into Node.js ECS logging? * [ECS Logging with Winston](/reference/winston.md) * [ECS Logging with Morgan](/reference/morgan.md) -If you’d like to try out a tutorial using Node.js ECS logging with winston, see [Ingest logs from a Node.js web application using Filebeat](docs-content://manage-data/ingest/ingesting-data-from-applications/ingest-logs-from-nodejs-web-application-using-filebeat.md). +If you'd like to try out a tutorial using Node.js ECS logging with winston, see [Ingest logs from a Node.js web application using Filebeat](docs-content://manage-data/ingest/ingesting-data-from-applications/ingest-logs-from-nodejs-web-application-using-filebeat.md). diff --git a/docs/reference/morgan.md b/docs/reference/morgan.md index 3f99fb5..a05573a 100644 --- a/docs/reference/morgan.md +++ b/docs/reference/morgan.md @@ -1,4 +1,7 @@ --- +applies_to: + stack: ga + serverless: ga mapped_pages: - https://www.elastic.co/guide/en/ecs-logging/nodejs/current/morgan.html --- @@ -39,6 +42,11 @@ app.listen(3000); ### Step 3: Configure Filebeat [morgan-setup-step-3] +```{applies_to} +stack: ga +serverless: unavailable +``` + The best way to collect the logs once they are ECS-formatted is with [Filebeat](beats://reference/filebeat/index.md): :::::::{tab-set} diff --git a/docs/reference/pino.md b/docs/reference/pino.md index bdecbe1..ade071a 100644 --- a/docs/reference/pino.md +++ b/docs/reference/pino.md @@ -1,4 +1,7 @@ --- +applies_to: + stack: ga + serverless: ga mapped_pages: - https://www.elastic.co/guide/en/ecs-logging/nodejs/current/pino.html --- @@ -30,7 +33,7 @@ log.error({ err: new Error('boom') }, 'oops there is a problem'); // ... ``` -1. This will [configure](https://getpino.io/#/docs/api?id=options) Pino’s `formatters`, `messageKey` and `timestamp` options. +1. This will [configure](https://getpino.io/#/docs/api?id=options) Pino's `formatters`, `messageKey` and `timestamp` options. See usage discussion and examples below. @@ -38,6 +41,11 @@ See usage discussion and examples below. ### Step 3: Configure Filebeat [pino-setup-step-3] +```{applies_to} +stack: ga +serverless: unavailable +``` + The best way to collect the logs once they are ECS-formatted is with [Filebeat](beats://reference/filebeat/index.md): :::::::{tab-set} @@ -185,7 +193,7 @@ will yield (pretty-printed for readability): } ``` -This is analogous to and overrides [Pino’s default err serializer](https://getpino.io/#/docs/api?id=serializers-object). Special handling of the `err` field can be disabled via the `convertErr: false` option: +This is analogous to and overrides [Pino's default err serializer](https://getpino.io/#/docs/api?id=serializers-object). Special handling of the `err` field can be disabled via the `convertErr: false` option: ```js const log = pino(ecsFormat({ convertErr: false })); diff --git a/docs/reference/winston.md b/docs/reference/winston.md index 65f7b06..14617ac 100644 --- a/docs/reference/winston.md +++ b/docs/reference/winston.md @@ -1,4 +1,7 @@ --- +applies_to: + stack: ga + serverless: ga mapped_pages: - https://www.elastic.co/guide/en/ecs-logging/nodejs/current/winston.html --- @@ -41,6 +44,11 @@ logger.error('oops there is a problem', { err: new Error('boom') }); ### Step 3: Configure Filebeat [winston-setup-step-3] +```{applies_to} +stack: ga +serverless: unavailable +``` + The best way to collect the logs once they are ECS-formatted is with [Filebeat](beats://reference/filebeat/index.md): :::::::{tab-set} @@ -168,7 +176,7 @@ Running this script (available [here](https://github.com/elastic/ecs-logging-nod {"@timestamp":"2023-10-14T02:14:17.304Z","log.level":"error","message":"oops there is a problem","ecs.version":"8.10.0","foo":"bar"} ``` -The formatter handles serialization to JSON, so you don’t need to add the [json](https://github.com/winstonjs/logform#json) formatter. As well, a timestamp is automatically generated by the formatter, so you don’t need to add the [timestamp](https://github.com/winstonjs/logform#timestamp) formatter. +The formatter handles serialization to JSON, so you don't need to add the [json](https://github.com/winstonjs/logform#json) formatter. As well, a timestamp is automatically generated by the formatter, so you don't need to add the [timestamp](https://github.com/winstonjs/logform#timestamp) formatter. ## Error logging [winston-error-logging]