fastify-graylog-reporter
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -1,2 +0,2 @@ | ||
# [1.3.0](https://github.com/Blynskyniki/fastify-graylog-reporter/compare/v1.2.0...v1.3.0) (2023-10-12) | ||
# [1.4.0](https://github.com/Blynskyniki/fastify-graylog-reporter/compare/v1.3.0...v1.4.0) (2023-10-12) | ||
@@ -6,2 +6,2 @@ | ||
* add version to message ([05ece32](https://github.com/Blynskyniki/fastify-graylog-reporter/commit/05ece329f9d55db2ee293a0ea292aeab909d86a2)) | ||
* make useChunks optional default false ([9fb271b](https://github.com/Blynskyniki/fastify-graylog-reporter/commit/9fb271bdb98cd54af83680d7347dd17ea6c19731)) |
/// <reference types="node" /> | ||
import { ConnectionOptions } from './grayLogGelfReporter'; | ||
type SerializeOptions = Pick<ConnectionOptions, 'compress' | 'minCompressSize' | 'maxChunkSize'>; | ||
type SerializeOptions = Pick<ConnectionOptions, 'compress' | 'minCompressSize' | 'maxChunkSize' | 'useChunks'>; | ||
export declare class GelfMessageSerializer { | ||
@@ -5,0 +5,0 @@ readonly options: SerializeOptions; |
@@ -12,5 +12,9 @@ "use strict"; | ||
async serialize(data) { | ||
var _a; | ||
if (data.length <= this.options.maxChunkSize) { | ||
return [data]; | ||
} | ||
if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.useChunks)) { | ||
return [data]; | ||
} | ||
if (!this.options.compress && data.length >= this.options.minCompressSize) { | ||
@@ -17,0 +21,0 @@ return this.createChunks(data); |
@@ -7,2 +7,3 @@ import { GelfMessageSerializer } from './gelfMessageSerializer'; | ||
port: number; | ||
useChunks?: boolean; | ||
logs?: boolean; | ||
@@ -9,0 +10,0 @@ compress: boolean; |
@@ -16,3 +16,3 @@ "use strict"; | ||
async report(data) { | ||
const { short_message, full_message, timestamp, host, ...other_fields } = data; | ||
const { logs, short_message, full_message, timestamp, host, ...other_fields } = data; | ||
const chunks = await this.serializer.serialize(Buffer.from(JSON.stringify({ | ||
@@ -19,0 +19,0 @@ 'version': '1.1', |
{ | ||
"name": "fastify-graylog-reporter", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"description": "Fastify plugin for report request data to Graylog", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/Blynskyniki/fastify-graylog-reporter#readme", |
@@ -6,3 +6,5 @@ # Fastify plugin for report request data to Graylog (GELF) | ||
[![NPM](https://nodei.co/npm/fastify-graylog-reporter.png)](https://nodei.co/npm/fastify-graylog-reporter/) | ||
## Usage | ||
1. Declare the input on Graylog WEB UI (support only UDP GELF) | ||
@@ -15,3 +17,3 @@ 2. Install plugin with ```npm i fastify-graylog-reporter``` | ||
/** | ||
* Register plugin | ||
* Register plugin | ||
*/ | ||
@@ -34,1 +36,18 @@ | ||
### Gelf query example | ||
```json | ||
{ | ||
"version": "1.1", | ||
"host": "example.org", | ||
"short_message": "A short message that helps you identify what is going on", | ||
"full_message": "Backtrace here\n\nmore stuff", | ||
"timestamp": 1385053862.3072, | ||
"level": 1, | ||
"_user_id": 9001, | ||
"_some_info": "foo", | ||
"_some_env_var": "bar" | ||
} | ||
``` | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25646
293
51