You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This set of libraries allows you to transform your application logs to structured logs that comply with the [Elastic Common Schema (ECS)](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html).
8
8
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](https://www.elastic.co/guide/en/observability/current/monitor-logs.html) to inspect all logs in one single place.
The `log.level` field will be "error" for response codes >= 500, otherwise
147
-
"info". For example, running https://github.com/elastic/ecs-logging-nodejs/blob/master/loggers/morgan/examples/express.js[examples/express.js]
147
+
"info". For example, running https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/morgan/examples/express.js[examples/express.js]
148
148
again, a `curl -i localhost:3000/error` will yield:
149
149
150
150
[source,cmd]
@@ -172,7 +172,7 @@ then fields are added to log records that {ecs-ref}/ecs-tracing.html[identify an
172
172
These fields allow cross linking between traces and logs in Kibana and support
173
173
log anomaly detection.
174
174
175
-
For example, running https://github.com/elastic/ecs-logging-nodejs/blob/master/loggers/morgan/examples/express-with-apm.js[examples/express-with-apm.js] and `curl -i localhost:3000/` results in a log record with the following:
175
+
For example, running https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/morgan/examples/express-with-apm.js[examples/express-with-apm.js] and `curl -i localhost:3000/` results in a log record with the following:
https://github.com/elastic/ecs-logging-nodejs/tree/main/loggers/pino/examples/express-with-pino-http.js[with the pino-http middleware package],
203
203
etc.
204
204
205
205
@@ -214,7 +214,7 @@ then fields are added to log records that {ecs-ref}/ecs-tracing.html[identify an
214
214
These fields allow cross linking between traces and logs in Kibana and support
215
215
log anomaly detection.
216
216
217
-
For example, running https://github.com/elastic/ecs-logging-nodejs/blob/master/loggers/pino/examples/http-with-elastic-apm.js[examples/http-with-elastic-apm.js] and `curl -i localhost:3000/` results in a log record with the following:
217
+
For example, running https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/pino/examples/http-with-elastic-apm.js[examples/http-with-elastic-apm.js] and `curl -i localhost:3000/` results in a log record with the following:
Copy file name to clipboardExpand all lines: docs/winston.asciidoc
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ logger.info('hi')
73
73
logger.error('oops there is a problem', { foo: 'bar' })
74
74
----
75
75
76
-
Running this script (available https://github.com/elastic/ecs-logging-nodejs/blob/master/loggers/winston/examples/basic.js[here]) will produce log output similar to the following:
76
+
Running this script (available https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/winston/examples/basic.js[here]) will produce log output similar to the following:
77
77
78
78
[source,cmd]
79
79
----
@@ -94,7 +94,7 @@ the https://github.com/winstonjs/logform#timestamp[timestamp] formatter.
94
94
95
95
By default, the formatter will convert an `err` meta field that is an Error instance
96
96
to {ecs-ref}/ecs-error.html[ECS Error fields].
97
-
For https://github.com/elastic/ecs-logging-nodejs/blob/master/loggers/winston/examples/error.js[example]:
97
+
For https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/winston/examples/error.js[example]:
98
98
99
99
[source,js]
100
100
----
@@ -182,7 +182,7 @@ function handler (req, res) {
182
182
183
183
This will produce logs with request and response info using
184
184
{ecs-ref}/ecs-http.html[ECS HTTP fields].
185
-
For https://github.com/elastic/ecs-logging-nodejs/blob/master/loggers/winston/examples/http.js[example]:
185
+
For https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/winston/examples/http.js[example]:
186
186
187
187
[source,cmd]
188
188
----
@@ -233,7 +233,7 @@ then fields are added to log records that {ecs-ref}/ecs-tracing.html[identify an
233
233
These fields allow cross linking between traces and logs in Kibana and support
234
234
log anomaly detection.
235
235
236
-
For example, running https://github.com/elastic/ecs-logging-nodejs/blob/master/loggers/winston/examples/http-with-elastic-apm.js[examples/http-with-elastic-apm.js] and `curl -i localhost:3000/` results in a log record with the following:
236
+
For example, running https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/winston/examples/http-with-elastic-apm.js[examples/http-with-elastic-apm.js] and `curl -i localhost:3000/` results in a log record with the following:
0 commit comments