Socket
Socket
Sign inDemoInstall

@elastic/ecs-morgan-format

Package Overview
Dependencies
10
Maintainers
75
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.2.0 to 0.3.0

11

CHANGELOG.md

@@ -1,8 +0,15 @@

# Changelog
# @elastic/ecs-morgan-format Changelog
## v0.3.0
- Serialize "log.level" as a top-level dotted field per
https://github.com/elastic/ecs-logging/pull/33.
[#23](https://github.com/elastic/ecs-logging-js/pull/23)
## v0.2.0
- Use the version number provided by ecs-helpers - [#13](https://github.com/elastic/ecs-logging-js/pull/13)
## v0.1.0
## v0.1.0
Initial release.

5

index.js

@@ -22,6 +22,3 @@ // Licensed to Elasticsearch B.V under one or more agreements.

'@timestamp': new Date().toISOString(),
log: {
level: res.statusCode < 500 ? 'info' : 'error',
logger: 'morgan'
},
'log.level': res.statusCode < 500 ? 'info' : 'error',
message: messageFormat(token, req, res),

@@ -28,0 +25,0 @@ ecs: { version }

{
"name": "@elastic/ecs-morgan-format",
"version": "0.2.0",
"version": "0.3.0",
"description": "A formatter for the morgan logger compatible with Elastic Common Schema.",

@@ -34,3 +34,3 @@ "main": "index.js",

"dependencies": {
"@elastic/ecs-helpers": "^0.2.0"
"@elastic/ecs-helpers": "^0.3.0"
},

@@ -37,0 +37,0 @@ "devDependencies": {

@@ -10,2 +10,8 @@ <img align="right" width="auto" height="auto" src="https://www.elastic.co/static-res/images/elastic-logo-200.png">

---
**Please note** that this library is in a **beta** version and backwards-incompatible changes might be introduced in future releases. While we strive to comply to [semver](https://semver.org/), we can not guarantee to avoid breaking changes in minor releases.
---
## Install

@@ -12,0 +18,0 @@ ```sh

@@ -62,3 +62,3 @@ // Licensed to Elasticsearch B.V under one or more agreements.

const log = JSON.parse(line)
t.is(line, `{"@timestamp":"${log['@timestamp']}","log":{"level":"info","logger":"morgan"},"message":"${JSON.stringify(log.message).slice(1, -1)}","ecs":{"version":"${version}"},"http":{"version":"1.1","request":{"method":"post","headers":{"accept-encoding":"gzip, deflate","content-type":"application/json","host":"${log.http.request.headers.host}","connection":"close"},"body":{"bytes":17}},"response":{"status_code":200,"headers":{"x-powered-by":"Express"}}},"url":{"path":"/","domain":"localhost","query":"foo=bar","full":"/?foo=bar"},"user_agent":{"original":"cool-agent"}}`)
t.is(line, `{"@timestamp":"${log['@timestamp']}","log.level":"info","message":"${JSON.stringify(log.message).slice(1, -1)}","ecs":{"version":"${version}"},"http":{"version":"1.1","request":{"method":"post","headers":{"accept-encoding":"gzip, deflate","content-type":"application/json","host":"${log.http.request.headers.host}","connection":"close"},"body":{"bytes":17}},"response":{"status_code":200,"headers":{"x-powered-by":"Express"}}},"url":{"path":"/","domain":"localhost","query":"foo=bar","full":"http://localhost:${server.address().port}/?foo=bar"},"user_agent":{"original":"cool-agent"}}`)
})

@@ -65,0 +65,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc