Skip to content

Commit 89caece

Browse files
docs: add applies_to and products frontmatter, scope Filebeat section (#228)
- Add mandatory applies_to (stack: ga, serverless: ga) and products to all four doc pages per Docs Versioning contributor guidelines. - Add section-level applies_to to Step 3: Configure Filebeat on winston, pino, and morgan (stack: ga, serverless: unavailable) so Serverless users see that the Filebeat collection path does not apply to them. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 86a5c1a commit 89caece

4 files changed

Lines changed: 32 additions & 5 deletions

File tree

docs/reference/index.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
---
2+
applies_to:
3+
stack: ga
4+
serverless: ga
25
mapped_pages:
36
- https://www.elastic.co/guide/en/ecs-logging/nodejs/current/intro.html
47
- https://www.elastic.co/guide/en/ecs-logging/nodejs/current/index.html
58
---
69

710
# ECS Logging Node.js [intro]
811

9-
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 [Kibanas Logs app](docs-content://solutions/observability/logs/explore-logs.md) to inspect all logs in one single place.
12+
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.
1013

1114
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:
1215

@@ -30,5 +33,5 @@ Ready to jump into Node.js ECS logging?
3033
* [ECS Logging with Winston](/reference/winston.md)
3134
* [ECS Logging with Morgan](/reference/morgan.md)
3235

33-
If youd 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).
36+
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).
3437

docs/reference/morgan.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
applies_to:
3+
stack: ga
4+
serverless: ga
25
mapped_pages:
36
- https://www.elastic.co/guide/en/ecs-logging/nodejs/current/morgan.html
47
---
@@ -39,6 +42,11 @@ app.listen(3000);
3942

4043
### Step 3: Configure Filebeat [morgan-setup-step-3]
4144

45+
```{applies_to}
46+
stack: ga
47+
serverless: unavailable
48+
```
49+
4250
The best way to collect the logs once they are ECS-formatted is with [Filebeat](beats://reference/filebeat/index.md):
4351

4452
:::::::{tab-set}

docs/reference/pino.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
applies_to:
3+
stack: ga
4+
serverless: ga
25
mapped_pages:
36
- https://www.elastic.co/guide/en/ecs-logging/nodejs/current/pino.html
47
---
@@ -30,14 +33,19 @@ log.error({ err: new Error('boom') }, 'oops there is a problem');
3033
// ...
3134
```
3235

33-
1. This will [configure](https://getpino.io/#/docs/api?id=options) Pinos `formatters`, `messageKey` and `timestamp` options.
36+
1. This will [configure](https://getpino.io/#/docs/api?id=options) Pino's `formatters`, `messageKey` and `timestamp` options.
3437

3538

3639
See usage discussion and examples below.
3740

3841

3942
### Step 3: Configure Filebeat [pino-setup-step-3]
4043

44+
```{applies_to}
45+
stack: ga
46+
serverless: unavailable
47+
```
48+
4149
The best way to collect the logs once they are ECS-formatted is with [Filebeat](beats://reference/filebeat/index.md):
4250

4351
:::::::{tab-set}
@@ -185,7 +193,7 @@ will yield (pretty-printed for readability):
185193
}
186194
```
187195

188-
This is analogous to and overrides [Pinos 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:
196+
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:
189197

190198
```js
191199
const log = pino(ecsFormat({ convertErr: false }));

docs/reference/winston.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
---
2+
applies_to:
3+
stack: ga
4+
serverless: ga
25
mapped_pages:
36
- https://www.elastic.co/guide/en/ecs-logging/nodejs/current/winston.html
47
---
@@ -41,6 +44,11 @@ logger.error('oops there is a problem', { err: new Error('boom') });
4144

4245
### Step 3: Configure Filebeat [winston-setup-step-3]
4346

47+
```{applies_to}
48+
stack: ga
49+
serverless: unavailable
50+
```
51+
4452
The best way to collect the logs once they are ECS-formatted is with [Filebeat](beats://reference/filebeat/index.md):
4553

4654
:::::::{tab-set}
@@ -168,7 +176,7 @@ Running this script (available [here](https://github.com/elastic/ecs-logging-nod
168176
{"@timestamp":"2023-10-14T02:14:17.304Z","log.level":"error","message":"oops there is a problem","ecs.version":"8.10.0","foo":"bar"}
169177
```
170178

171-
The formatter handles serialization to JSON, so you dont need to add the [json](https://github.com/winstonjs/logform#json) formatter. As well, a timestamp is automatically generated by the formatter, so you dont need to add the [timestamp](https://github.com/winstonjs/logform#timestamp) formatter.
179+
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.
172180

173181

174182
## Error logging [winston-error-logging]

0 commit comments

Comments
 (0)