@bsb/syslog 9.1.3 → 9.6.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -26,51 +26,51 @@
26
26
  */
27
27
  import { BSBObservable, BSBObservableConstructor, BSBError } from "@bsb/base";
28
28
  import { DTrace, LogMeta } from "@bsb/base";
29
- import * as av from "@anyvali/js";
29
+ import * as av from "anyvali";
30
30
  /**
31
31
  * Configuration schema for syslog client observable
32
32
  */
33
33
  export declare const SyslogClientConfigSchema: av.ObjectSchema<{
34
- host: av.OptionalSchema<av.StringSchema>;
35
- port: av.OptionalSchema<av.Int32Schema>;
36
- protocol: av.OptionalSchema<av.EnumSchema<string[]>>;
34
+ host: av.StringSchema;
35
+ port: av.Int32Schema;
36
+ protocol: av.EnumSchema<string[]>;
37
37
  tls: av.OptionalSchema<av.ObjectSchema<{
38
- rejectUnauthorized: av.OptionalSchema<av.BoolSchema>;
38
+ rejectUnauthorized: av.BoolSchema;
39
39
  ca: av.OptionalSchema<av.StringSchema>;
40
40
  cert: av.OptionalSchema<av.StringSchema>;
41
41
  key: av.OptionalSchema<av.StringSchema>;
42
42
  }>>;
43
- facility: av.OptionalSchema<av.Int32Schema>;
43
+ facility: av.Int32Schema;
44
44
  hostname: av.OptionalSchema<av.StringSchema>;
45
- appName: av.OptionalSchema<av.StringSchema>;
46
- rfc: av.OptionalSchema<av.EnumSchema<string[]>>;
45
+ appName: av.StringSchema;
46
+ rfc: av.EnumSchema<string[]>;
47
47
  levels: av.ObjectSchema<{
48
- debug: av.OptionalSchema<av.BoolSchema>;
49
- info: av.OptionalSchema<av.BoolSchema>;
50
- warn: av.OptionalSchema<av.BoolSchema>;
51
- error: av.OptionalSchema<av.BoolSchema>;
48
+ debug: av.BoolSchema;
49
+ info: av.BoolSchema;
50
+ warn: av.BoolSchema;
51
+ error: av.BoolSchema;
52
52
  }>;
53
53
  }>;
54
54
  export type SyslogClientConfig = av.Infer<typeof SyslogClientConfigSchema>;
55
55
  export declare const Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
56
- host: av.OptionalSchema<av.StringSchema>;
57
- port: av.OptionalSchema<av.Int32Schema>;
58
- protocol: av.OptionalSchema<av.EnumSchema<string[]>>;
56
+ host: av.StringSchema;
57
+ port: av.Int32Schema;
58
+ protocol: av.EnumSchema<string[]>;
59
59
  tls: av.OptionalSchema<av.ObjectSchema<{
60
- rejectUnauthorized: av.OptionalSchema<av.BoolSchema>;
60
+ rejectUnauthorized: av.BoolSchema;
61
61
  ca: av.OptionalSchema<av.StringSchema>;
62
62
  cert: av.OptionalSchema<av.StringSchema>;
63
63
  key: av.OptionalSchema<av.StringSchema>;
64
64
  }>>;
65
- facility: av.OptionalSchema<av.Int32Schema>;
65
+ facility: av.Int32Schema;
66
66
  hostname: av.OptionalSchema<av.StringSchema>;
67
- appName: av.OptionalSchema<av.StringSchema>;
68
- rfc: av.OptionalSchema<av.EnumSchema<string[]>>;
67
+ appName: av.StringSchema;
68
+ rfc: av.EnumSchema<string[]>;
69
69
  levels: av.ObjectSchema<{
70
- debug: av.OptionalSchema<av.BoolSchema>;
71
- info: av.OptionalSchema<av.BoolSchema>;
72
- warn: av.OptionalSchema<av.BoolSchema>;
73
- error: av.OptionalSchema<av.BoolSchema>;
70
+ debug: av.BoolSchema;
71
+ info: av.BoolSchema;
72
+ warn: av.BoolSchema;
73
+ error: av.BoolSchema;
74
74
  }>;
75
75
  }>>;
76
76
  /**
@@ -78,24 +78,24 @@ export declare const Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectS
78
78
  */
79
79
  export declare class Plugin extends BSBObservable<InstanceType<typeof Config>> {
80
80
  static Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
81
- host: av.OptionalSchema<av.StringSchema>;
82
- port: av.OptionalSchema<av.Int32Schema>;
83
- protocol: av.OptionalSchema<av.EnumSchema<string[]>>;
81
+ host: av.StringSchema;
82
+ port: av.Int32Schema;
83
+ protocol: av.EnumSchema<string[]>;
84
84
  tls: av.OptionalSchema<av.ObjectSchema<{
85
- rejectUnauthorized: av.OptionalSchema<av.BoolSchema>;
85
+ rejectUnauthorized: av.BoolSchema;
86
86
  ca: av.OptionalSchema<av.StringSchema>;
87
87
  cert: av.OptionalSchema<av.StringSchema>;
88
88
  key: av.OptionalSchema<av.StringSchema>;
89
89
  }>>;
90
- facility: av.OptionalSchema<av.Int32Schema>;
90
+ facility: av.Int32Schema;
91
91
  hostname: av.OptionalSchema<av.StringSchema>;
92
- appName: av.OptionalSchema<av.StringSchema>;
93
- rfc: av.OptionalSchema<av.EnumSchema<string[]>>;
92
+ appName: av.StringSchema;
93
+ rfc: av.EnumSchema<string[]>;
94
94
  levels: av.ObjectSchema<{
95
- debug: av.OptionalSchema<av.BoolSchema>;
96
- info: av.OptionalSchema<av.BoolSchema>;
97
- warn: av.OptionalSchema<av.BoolSchema>;
98
- error: av.OptionalSchema<av.BoolSchema>;
95
+ debug: av.BoolSchema;
96
+ info: av.BoolSchema;
97
+ warn: av.BoolSchema;
98
+ error: av.BoolSchema;
99
99
  }>;
100
100
  }>>;
101
101
  private logFormatter;
@@ -25,7 +25,7 @@
25
25
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
26
26
  */
27
27
  import { BSBObservable, createConfigSchema, LogFormatter, BSBError } from "@bsb/base";
28
- import * as av from "@anyvali/js";
28
+ import * as av from "anyvali";
29
29
  import { hostname } from "node:os";
30
30
  // @ts-ignore - no types available
31
31
  import * as SyslogClient from "syslog-client";
@@ -33,26 +33,26 @@ import * as SyslogClient from "syslog-client";
33
33
  * Configuration schema for syslog client observable
34
34
  */
35
35
  export const SyslogClientConfigSchema = av.object({
36
- host: av.optional(av.string()).default("localhost"),
37
- port: av.optional(av.int32().min(1).max(65535)).default(514),
38
- protocol: av.optional(av.enum_(["udp", "tcp", "tls"])).default("udp"),
36
+ host: av.string().default("localhost").describe("Syslog server hostname"),
37
+ port: av.int32().min(1).max(65535).default(514).describe("Syslog server port"),
38
+ protocol: av.enum_(["udp", "tcp", "tls"]).default("udp").describe("Transport protocol used to send syslog messages"),
39
39
  tls: av.optional(av.object({
40
- rejectUnauthorized: av.optional(av.bool()).default(true),
41
- ca: av.optional(av.string()),
42
- cert: av.optional(av.string()),
43
- key: av.optional(av.string()),
44
- }, { unknownKeys: "strip" })),
45
- facility: av.optional(av.int32().min(0).max(23)).default(16),
46
- hostname: av.optional(av.string()),
47
- appName: av.optional(av.string()).default("bsb-app"),
48
- rfc: av.optional(av.enum_(["3164", "5424"])).default("5424"),
40
+ rejectUnauthorized: av.bool().default(true).describe("Whether TLS certificate validation rejects unauthorized certificates"),
41
+ ca: av.optional(av.string()).describe("Optional TLS certificate authority data"),
42
+ cert: av.optional(av.string()).describe("Optional TLS client certificate data"),
43
+ key: av.optional(av.string()).describe("Optional TLS client private key data"),
44
+ }).describe("TLS connection settings for syslog transport")),
45
+ facility: av.int32().min(0).max(23).default(16).describe("Syslog facility code"),
46
+ hostname: av.optional(av.string()).describe("Hostname reported in syslog messages, defaulting to the local hostname"),
47
+ appName: av.string().default("bsb-app").describe("Application name reported in syslog messages"),
48
+ rfc: av.enum_(["3164", "5424"]).default("5424").describe("Syslog message format RFC"),
49
49
  levels: av.object({
50
- debug: av.optional(av.bool()).default(true),
51
- info: av.optional(av.bool()).default(true),
52
- warn: av.optional(av.bool()).default(true),
53
- error: av.optional(av.bool()).default(true),
54
- }, { unknownKeys: "strip" }),
55
- }, { unknownKeys: "strip" });
50
+ debug: av.bool().default(true).describe("Whether debug logs are sent to syslog"),
51
+ info: av.bool().default(true).describe("Whether info logs are sent to syslog"),
52
+ warn: av.bool().default(true).describe("Whether warning logs are sent to syslog"),
53
+ error: av.bool().default(true).describe("Whether error logs are sent to syslog"),
54
+ }).describe("Log level enablement"),
55
+ }).describe("Syslog client observable plugin configuration");
56
56
  export const Config = createConfigSchema({
57
57
  name: 'observable-syslog',
58
58
  description: 'Syslog client observable plugin for forwarding logs to syslog servers',
@@ -26,7 +26,7 @@
26
26
  */
27
27
  import { BSBService, BSBServiceConstructor, BSBServiceClient } from "@bsb/base";
28
28
  import { Observable } from "@bsb/base";
29
- import * as av from "@anyvali/js";
29
+ import * as av from "anyvali";
30
30
  /**
31
31
  * Syslog message structure
32
32
  */
@@ -42,15 +42,15 @@ export type SyslogMessage = av.Infer<typeof SyslogMessageSchema>;
42
42
  * Configuration schema for syslog server
43
43
  */
44
44
  export declare const SyslogServerConfigSchema: av.ObjectSchema<{
45
- port: av.OptionalSchema<av.Int32Schema>;
46
- address: av.OptionalSchema<av.StringSchema>;
47
- exclusive: av.OptionalSchema<av.BoolSchema>;
45
+ port: av.Int32Schema;
46
+ address: av.StringSchema;
47
+ exclusive: av.BoolSchema;
48
48
  }>;
49
49
  export type SyslogServerConfig = av.Infer<typeof SyslogServerConfigSchema>;
50
50
  export declare const Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
51
- port: av.OptionalSchema<av.Int32Schema>;
52
- address: av.OptionalSchema<av.StringSchema>;
53
- exclusive: av.OptionalSchema<av.BoolSchema>;
51
+ port: av.Int32Schema;
52
+ address: av.StringSchema;
53
+ exclusive: av.BoolSchema;
54
54
  }>>;
55
55
  /**
56
56
  * Event schemas for syslog server
@@ -80,9 +80,9 @@ export declare const EventSchemas: {
80
80
  */
81
81
  export declare class Plugin extends BSBService<InstanceType<typeof Config>, typeof EventSchemas> {
82
82
  static Config: import("@bsb/base").BSBPluginConfigClass<av.ObjectSchema<{
83
- port: av.OptionalSchema<av.Int32Schema>;
84
- address: av.OptionalSchema<av.StringSchema>;
85
- exclusive: av.OptionalSchema<av.BoolSchema>;
83
+ port: av.Int32Schema;
84
+ address: av.StringSchema;
85
+ exclusive: av.BoolSchema;
86
86
  }>>;
87
87
  static EventSchemas: {
88
88
  readonly emitEvents: {
@@ -25,7 +25,7 @@
25
25
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
26
26
  */
27
27
  import { BSBService, BSBServiceClient, createConfigSchema, bsb } from "@bsb/base";
28
- import * as av from "@anyvali/js";
28
+ import * as av from "anyvali";
29
29
  import { createFireAndForgetEvent } from "@bsb/base";
30
30
  // @ts-ignore - no types available
31
31
  import SyslogServer from "syslog-server";
@@ -33,20 +33,20 @@ import SyslogServer from "syslog-server";
33
33
  * Syslog message structure
34
34
  */
35
35
  export const SyslogMessageSchema = av.object({
36
- gatewayTime: av.number(),
37
- date: av.number(),
38
- host: av.string(),
39
- protocol: av.string(),
40
- message: av.string(),
41
- }, { unknownKeys: "strip" });
36
+ gatewayTime: av.number().describe("Timestamp when the syslog gateway received the message"),
37
+ date: av.number().describe("Timestamp parsed from the syslog message"),
38
+ host: av.string().describe("Host reported by the syslog sender"),
39
+ protocol: av.string().describe("Protocol used to receive the syslog message"),
40
+ message: av.string().describe("Raw syslog message body"),
41
+ }).describe("Syslog message event payload");
42
42
  /**
43
43
  * Configuration schema for syslog server
44
44
  */
45
45
  export const SyslogServerConfigSchema = av.object({
46
- port: av.optional(av.int32().min(1).max(65535)).default(514),
47
- address: av.optional(av.string()).default("0.0.0.0"),
48
- exclusive: av.optional(av.bool()).default(false),
49
- }, { unknownKeys: "strip" });
46
+ port: av.int32().min(1).max(65535).default(514).describe("UDP port the syslog server listens on"),
47
+ address: av.string().default("0.0.0.0").describe("Network address the syslog server binds to"),
48
+ exclusive: av.bool().default(false).describe("Whether the server requests exclusive address binding"),
49
+ }).describe("Syslog server plugin configuration");
50
50
  export const Config = createConfigSchema({
51
51
  name: 'service-syslog-server',
52
52
  description: 'Syslog server service plugin that receives messages and emits events',
@@ -1,40 +1,40 @@
1
1
  {
2
2
  "pluginName": "observable-syslog",
3
3
  "events": {},
4
- "version": "9.1.3",
4
+ "version": "9.6.12",
5
5
  "configSchema": {
6
6
  "anyvaliVersion": "1.0",
7
- "schemaVersion": "1",
7
+ "schemaVersion": "1.1",
8
8
  "root": {
9
9
  "kind": "object",
10
10
  "properties": {
11
11
  "host": {
12
- "kind": "optional",
13
- "inner": {
14
- "kind": "string"
15
- },
16
- "default": "localhost"
12
+ "kind": "string",
13
+ "default": "localhost",
14
+ "metadata": {
15
+ "description": "Syslog server hostname"
16
+ }
17
17
  },
18
18
  "port": {
19
- "kind": "optional",
20
- "inner": {
21
- "kind": "int32",
22
- "min": 1,
23
- "max": 65535
24
- },
25
- "default": 514
19
+ "kind": "int32",
20
+ "min": 1,
21
+ "max": 65535,
22
+ "default": 514,
23
+ "metadata": {
24
+ "description": "Syslog server port"
25
+ }
26
26
  },
27
27
  "protocol": {
28
- "kind": "optional",
29
- "inner": {
30
- "kind": "enum",
31
- "values": [
32
- "udp",
33
- "tcp",
34
- "tls"
35
- ]
36
- },
37
- "default": "udp"
28
+ "kind": "enum",
29
+ "values": [
30
+ "udp",
31
+ "tcp",
32
+ "tls"
33
+ ],
34
+ "default": "udp",
35
+ "metadata": {
36
+ "description": "Transport protocol used to send syslog messages"
37
+ }
38
38
  },
39
39
  "tls": {
40
40
  "kind": "optional",
@@ -42,108 +42,142 @@
42
42
  "kind": "object",
43
43
  "properties": {
44
44
  "rejectUnauthorized": {
45
- "kind": "optional",
46
- "inner": {
47
- "kind": "bool"
48
- },
49
- "default": true
45
+ "kind": "bool",
46
+ "default": true,
47
+ "metadata": {
48
+ "description": "Whether TLS certificate validation rejects unauthorized certificates"
49
+ }
50
50
  },
51
51
  "ca": {
52
52
  "kind": "optional",
53
53
  "inner": {
54
54
  "kind": "string"
55
+ },
56
+ "metadata": {
57
+ "description": "Optional TLS certificate authority data"
55
58
  }
56
59
  },
57
60
  "cert": {
58
61
  "kind": "optional",
59
62
  "inner": {
60
63
  "kind": "string"
64
+ },
65
+ "metadata": {
66
+ "description": "Optional TLS client certificate data"
61
67
  }
62
68
  },
63
69
  "key": {
64
70
  "kind": "optional",
65
71
  "inner": {
66
72
  "kind": "string"
73
+ },
74
+ "metadata": {
75
+ "description": "Optional TLS client private key data"
67
76
  }
68
77
  }
69
78
  },
70
- "required": [],
71
- "unknownKeys": "strip"
79
+ "required": [
80
+ "rejectUnauthorized"
81
+ ],
82
+ "unknownKeys": "strip",
83
+ "metadata": {
84
+ "description": "TLS connection settings for syslog transport"
85
+ }
72
86
  }
73
87
  },
74
88
  "facility": {
75
- "kind": "optional",
76
- "inner": {
77
- "kind": "int32",
78
- "min": 0,
79
- "max": 23
80
- },
81
- "default": 16
89
+ "kind": "int32",
90
+ "min": 0,
91
+ "max": 23,
92
+ "default": 16,
93
+ "metadata": {
94
+ "description": "Syslog facility code"
95
+ }
82
96
  },
83
97
  "hostname": {
84
98
  "kind": "optional",
85
99
  "inner": {
86
100
  "kind": "string"
101
+ },
102
+ "metadata": {
103
+ "description": "Hostname reported in syslog messages, defaulting to the local hostname"
87
104
  }
88
105
  },
89
106
  "appName": {
90
- "kind": "optional",
91
- "inner": {
92
- "kind": "string"
93
- },
94
- "default": "bsb-app"
107
+ "kind": "string",
108
+ "default": "bsb-app",
109
+ "metadata": {
110
+ "description": "Application name reported in syslog messages"
111
+ }
95
112
  },
96
113
  "rfc": {
97
- "kind": "optional",
98
- "inner": {
99
- "kind": "enum",
100
- "values": [
101
- "3164",
102
- "5424"
103
- ]
104
- },
105
- "default": "5424"
114
+ "kind": "enum",
115
+ "values": [
116
+ "3164",
117
+ "5424"
118
+ ],
119
+ "default": "5424",
120
+ "metadata": {
121
+ "description": "Syslog message format RFC"
122
+ }
106
123
  },
107
124
  "levels": {
108
125
  "kind": "object",
109
126
  "properties": {
110
127
  "debug": {
111
- "kind": "optional",
112
- "inner": {
113
- "kind": "bool"
114
- },
115
- "default": true
128
+ "kind": "bool",
129
+ "default": true,
130
+ "metadata": {
131
+ "description": "Whether debug logs are sent to syslog"
132
+ }
116
133
  },
117
134
  "info": {
118
- "kind": "optional",
119
- "inner": {
120
- "kind": "bool"
121
- },
122
- "default": true
135
+ "kind": "bool",
136
+ "default": true,
137
+ "metadata": {
138
+ "description": "Whether info logs are sent to syslog"
139
+ }
123
140
  },
124
141
  "warn": {
125
- "kind": "optional",
126
- "inner": {
127
- "kind": "bool"
128
- },
129
- "default": true
142
+ "kind": "bool",
143
+ "default": true,
144
+ "metadata": {
145
+ "description": "Whether warning logs are sent to syslog"
146
+ }
130
147
  },
131
148
  "error": {
132
- "kind": "optional",
133
- "inner": {
134
- "kind": "bool"
135
- },
136
- "default": true
149
+ "kind": "bool",
150
+ "default": true,
151
+ "metadata": {
152
+ "description": "Whether error logs are sent to syslog"
153
+ }
137
154
  }
138
155
  },
139
- "required": [],
140
- "unknownKeys": "strip"
156
+ "required": [
157
+ "debug",
158
+ "info",
159
+ "warn",
160
+ "error"
161
+ ],
162
+ "unknownKeys": "strip",
163
+ "metadata": {
164
+ "description": "Log level enablement"
165
+ }
141
166
  }
142
167
  },
143
168
  "required": [
169
+ "host",
170
+ "port",
171
+ "protocol",
172
+ "facility",
173
+ "appName",
174
+ "rfc",
144
175
  "levels"
145
176
  ],
146
- "unknownKeys": "strip"
177
+ "unknownKeys": "strip",
178
+ "metadata": {
179
+ "description": "Syslog client observable plugin configuration"
180
+ }
147
181
  },
148
182
  "definitions": {},
149
183
  "extensions": {}