clever-tools 4.11.0 → 5.0.0
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.
- package/bin/clever.js +5 -10
- package/package.json +27 -27
- package/src/commands/accesslogs/accesslogs.command.js +27 -19
- package/src/commands/accesslogs/accesslogs.docs.md +1 -1
- package/src/commands/addon/addon.docs.md +2 -2
- package/src/commands/config-provider/config-provider.docs.md +5 -5
- package/src/commands/database/database.docs.md +2 -2
- package/src/commands/deploy/deploy.docs.md +7 -7
- package/src/commands/drain/drain.args.js +6 -0
- package/src/commands/drain/drain.create.betterstack.command.js +36 -0
- package/src/commands/drain/drain.create.command.js +0 -132
- package/src/commands/drain/drain.create.datadog.command.js +27 -0
- package/src/commands/drain/drain.create.elasticsearch.command.js +48 -0
- package/src/commands/drain/drain.create.newrelic.command.js +36 -0
- package/src/commands/drain/drain.create.ovh-tcp.command.js +29 -0
- package/src/commands/drain/drain.create.raw-http.command.js +30 -0
- package/src/commands/drain/drain.create.splunk.command.js +61 -0
- package/src/commands/drain/drain.create.syslog-tcp.command.js +29 -0
- package/src/commands/drain/drain.create.syslog-udp.command.js +29 -0
- package/src/commands/drain/drain.docs.md +273 -8
- package/src/commands/drain/drain.options.js +26 -0
- package/src/commands/features/features.list.command.js +6 -13
- package/src/commands/global.commands.js +23 -1
- package/src/commands/global.options.js +1 -1
- package/src/commands/k8s/k8s.docs.md +17 -17
- package/src/commands/keycloak/keycloak.docs.md +11 -11
- package/src/commands/kv/kv.docs.md +1 -1
- package/src/commands/link/link.docs.md +1 -1
- package/src/commands/login/login.command.js +11 -1
- package/src/commands/matomo/matomo.docs.md +6 -6
- package/src/commands/metabase/metabase.docs.md +9 -9
- package/src/commands/ng/ng.docs.md +10 -10
- package/src/commands/oauth-consumers/oauth-consumers.docs.md +4 -4
- package/src/commands/otoroshi/otoroshi.docs.md +13 -13
- package/src/commands/service/service.docs.md +4 -4
- package/src/commands/ssh/ssh.command.js +6 -0
- package/src/config/features.js +61 -29
- package/src/format-table.js +14 -10
- package/src/initial-setup.js +13 -0
- package/src/initial-update-notifier.js +2 -5
- package/src/lib/access-logs-transport.js +29 -0
- package/src/lib/cliparse-patched.js +1 -1
- package/src/models/drain.js +39 -13
- package/src/models/git-system.js +2 -2
- package/src/models/git.js +1 -1
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { styleText } from '../../lib/style-text.js';
|
|
3
|
+
import { Logger } from '../../logger.js';
|
|
4
|
+
import { createLogDrain, resolveDrainResource } from '../../models/drain.js';
|
|
5
|
+
import { addonIdOrRealIdOption, aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
6
|
+
import { drainUrlArg } from './drain.args.js';
|
|
7
|
+
import { drainSdParamsOption } from './drain.options.js';
|
|
8
|
+
|
|
9
|
+
export const drainCreateOvhTcpCommand = defineCommand({
|
|
10
|
+
description: 'Create an OVH TCP drain',
|
|
11
|
+
since: '0.9.0',
|
|
12
|
+
options: {
|
|
13
|
+
rfc5424StructuredDataParameters: drainSdParamsOption,
|
|
14
|
+
alias: aliasOption,
|
|
15
|
+
appIdOrName: appIdOrNameOption,
|
|
16
|
+
addonIdOrRealId: addonIdOrRealIdOption,
|
|
17
|
+
},
|
|
18
|
+
args: [drainUrlArg],
|
|
19
|
+
async handler(options, url) {
|
|
20
|
+
const { alias, appIdOrName, addonIdOrRealId, rfc5424StructuredDataParameters } = options;
|
|
21
|
+
const { ownerId, resourceId } = await resolveDrainResource(alias, appIdOrName, addonIdOrRealId);
|
|
22
|
+
|
|
23
|
+
const drain = await createLogDrain('OVH_TCP', ownerId, resourceId, url, { rfc5424StructuredDataParameters });
|
|
24
|
+
|
|
25
|
+
Logger.printSuccess(
|
|
26
|
+
`OVH TCP drain ${styleText(['bold', 'green'], drain.id)} has been successfully created and enabled!`,
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { styleText } from '../../lib/style-text.js';
|
|
3
|
+
import { Logger } from '../../logger.js';
|
|
4
|
+
import { createLogDrain, resolveDrainResource } from '../../models/drain.js';
|
|
5
|
+
import { addonIdOrRealIdOption, aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
6
|
+
import { drainUrlArg } from './drain.args.js';
|
|
7
|
+
import { drainPasswordOption, drainUsernameOption } from './drain.options.js';
|
|
8
|
+
|
|
9
|
+
export const drainCreateRawHttpCommand = defineCommand({
|
|
10
|
+
description: 'Create a raw HTTP drain',
|
|
11
|
+
since: '0.9.0',
|
|
12
|
+
options: {
|
|
13
|
+
username: drainUsernameOption,
|
|
14
|
+
password: drainPasswordOption,
|
|
15
|
+
alias: aliasOption,
|
|
16
|
+
appIdOrName: appIdOrNameOption,
|
|
17
|
+
addonIdOrRealId: addonIdOrRealIdOption,
|
|
18
|
+
},
|
|
19
|
+
args: [drainUrlArg],
|
|
20
|
+
async handler(options, url) {
|
|
21
|
+
const { alias, appIdOrName, addonIdOrRealId, username, password } = options;
|
|
22
|
+
const { ownerId, resourceId } = await resolveDrainResource(alias, appIdOrName, addonIdOrRealId);
|
|
23
|
+
|
|
24
|
+
const drain = await createLogDrain('RAW_HTTP', ownerId, resourceId, url, { username, password });
|
|
25
|
+
|
|
26
|
+
Logger.printSuccess(
|
|
27
|
+
`Raw HTTP drain ${styleText(['bold', 'green'], drain.id)} has been successfully created and enabled!`,
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
3
|
+
import { defineOption } from '../../lib/define-option.js';
|
|
4
|
+
import { styleText } from '../../lib/style-text.js';
|
|
5
|
+
import { Logger } from '../../logger.js';
|
|
6
|
+
import { createLogDrain, resolveDrainResource } from '../../models/drain.js';
|
|
7
|
+
import { addonIdOrRealIdOption, aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
8
|
+
import { drainUrlArg } from './drain.args.js';
|
|
9
|
+
|
|
10
|
+
export const drainCreateSplunkCommand = defineCommand({
|
|
11
|
+
description: 'Create a Splunk HEC drain',
|
|
12
|
+
since: '5.0.0',
|
|
13
|
+
options: {
|
|
14
|
+
token: defineOption({
|
|
15
|
+
name: 'hec-token',
|
|
16
|
+
schema: z.string().min(1),
|
|
17
|
+
description: 'HTTP Event Collector token',
|
|
18
|
+
placeholder: 'hec-token',
|
|
19
|
+
}),
|
|
20
|
+
index: defineOption({
|
|
21
|
+
name: 'index',
|
|
22
|
+
schema: z.string().min(1).optional(),
|
|
23
|
+
description: "Optional target index, the HEC token's own index is used if not set",
|
|
24
|
+
placeholder: 'index',
|
|
25
|
+
}),
|
|
26
|
+
sourcetype: defineOption({
|
|
27
|
+
name: 'sourcetype',
|
|
28
|
+
schema: z.string().min(1).optional(),
|
|
29
|
+
description: "Optional sourcetype, the HEC token's own sourcetype is used if not set",
|
|
30
|
+
placeholder: 'sourcetype',
|
|
31
|
+
}),
|
|
32
|
+
tlsVerification: defineOption({
|
|
33
|
+
name: 'tls-verification',
|
|
34
|
+
schema: z
|
|
35
|
+
.enum(['default', 'trustful'])
|
|
36
|
+
.transform((v) => v.toUpperCase())
|
|
37
|
+
.optional(),
|
|
38
|
+
description: 'TLS verification mode, use `trustful` to accept a self-signed certificate',
|
|
39
|
+
placeholder: 'tls-verification',
|
|
40
|
+
}),
|
|
41
|
+
alias: aliasOption,
|
|
42
|
+
appIdOrName: appIdOrNameOption,
|
|
43
|
+
addonIdOrRealId: addonIdOrRealIdOption,
|
|
44
|
+
},
|
|
45
|
+
args: [drainUrlArg],
|
|
46
|
+
async handler(options, url) {
|
|
47
|
+
const { alias, appIdOrName, addonIdOrRealId, token, index, sourcetype, tlsVerification } = options;
|
|
48
|
+
const { ownerId, resourceId } = await resolveDrainResource(alias, appIdOrName, addonIdOrRealId);
|
|
49
|
+
|
|
50
|
+
const drain = await createLogDrain('SPLUNK', ownerId, resourceId, url, {
|
|
51
|
+
token,
|
|
52
|
+
index,
|
|
53
|
+
sourcetype,
|
|
54
|
+
tlsVerification,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
Logger.printSuccess(
|
|
58
|
+
`Splunk drain ${styleText(['bold', 'green'], drain.id)} has been successfully created and enabled!`,
|
|
59
|
+
);
|
|
60
|
+
},
|
|
61
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { styleText } from '../../lib/style-text.js';
|
|
3
|
+
import { Logger } from '../../logger.js';
|
|
4
|
+
import { createLogDrain, resolveDrainResource } from '../../models/drain.js';
|
|
5
|
+
import { addonIdOrRealIdOption, aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
6
|
+
import { drainUrlArg } from './drain.args.js';
|
|
7
|
+
import { drainSdParamsOption } from './drain.options.js';
|
|
8
|
+
|
|
9
|
+
export const drainCreateSyslogTcpCommand = defineCommand({
|
|
10
|
+
description: 'Create a Syslog TCP drain',
|
|
11
|
+
since: '0.9.0',
|
|
12
|
+
options: {
|
|
13
|
+
rfc5424StructuredDataParameters: drainSdParamsOption,
|
|
14
|
+
alias: aliasOption,
|
|
15
|
+
appIdOrName: appIdOrNameOption,
|
|
16
|
+
addonIdOrRealId: addonIdOrRealIdOption,
|
|
17
|
+
},
|
|
18
|
+
args: [drainUrlArg],
|
|
19
|
+
async handler(options, url) {
|
|
20
|
+
const { alias, appIdOrName, addonIdOrRealId, rfc5424StructuredDataParameters } = options;
|
|
21
|
+
const { ownerId, resourceId } = await resolveDrainResource(alias, appIdOrName, addonIdOrRealId);
|
|
22
|
+
|
|
23
|
+
const drain = await createLogDrain('SYSLOG_TCP', ownerId, resourceId, url, { rfc5424StructuredDataParameters });
|
|
24
|
+
|
|
25
|
+
Logger.printSuccess(
|
|
26
|
+
`Syslog TCP drain ${styleText(['bold', 'green'], drain.id)} has been successfully created and enabled!`,
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineCommand } from '../../lib/define-command.js';
|
|
2
|
+
import { styleText } from '../../lib/style-text.js';
|
|
3
|
+
import { Logger } from '../../logger.js';
|
|
4
|
+
import { createLogDrain, resolveDrainResource } from '../../models/drain.js';
|
|
5
|
+
import { addonIdOrRealIdOption, aliasOption, appIdOrNameOption } from '../global.options.js';
|
|
6
|
+
import { drainUrlArg } from './drain.args.js';
|
|
7
|
+
import { drainSdParamsOption } from './drain.options.js';
|
|
8
|
+
|
|
9
|
+
export const drainCreateSyslogUdpCommand = defineCommand({
|
|
10
|
+
description: 'Create a Syslog UDP drain',
|
|
11
|
+
since: '0.9.0',
|
|
12
|
+
options: {
|
|
13
|
+
rfc5424StructuredDataParameters: drainSdParamsOption,
|
|
14
|
+
alias: aliasOption,
|
|
15
|
+
appIdOrName: appIdOrNameOption,
|
|
16
|
+
addonIdOrRealId: addonIdOrRealIdOption,
|
|
17
|
+
},
|
|
18
|
+
args: [drainUrlArg],
|
|
19
|
+
async handler(options, url) {
|
|
20
|
+
const { alias, appIdOrName, addonIdOrRealId, rfc5424StructuredDataParameters } = options;
|
|
21
|
+
const { ownerId, resourceId } = await resolveDrainResource(alias, appIdOrName, addonIdOrRealId);
|
|
22
|
+
|
|
23
|
+
const drain = await createLogDrain('SYSLOG_UDP', ownerId, resourceId, url, { rfc5424StructuredDataParameters });
|
|
24
|
+
|
|
25
|
+
Logger.printSuccess(
|
|
26
|
+
`Syslog UDP drain ${styleText(['bold', 'green'], drain.id)} has been successfully created and enabled!`,
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
});
|
|
@@ -45,14 +45,184 @@ clever drain check <drain-id> [options]
|
|
|
45
45
|
Create a drain
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
clever drain create
|
|
48
|
+
clever drain create
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## ➡️ `clever drain create betterstack` <kbd>Since 4.11.0</kbd>
|
|
52
|
+
|
|
53
|
+
Create a Better Stack drain
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
clever drain create betterstack --source-token <source-token> <drain-url> [options]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 📥 Arguments
|
|
60
|
+
|
|
61
|
+
|Name|Description|
|
|
62
|
+
|---|---|
|
|
63
|
+
|`drain-url`|Drain URL|
|
|
64
|
+
|
|
65
|
+
### ⚙️ Options
|
|
66
|
+
|
|
67
|
+
|Name|Description|
|
|
68
|
+
|---|---|
|
|
69
|
+
|`-t`, `--source-token` `<source-token>`|Source token **(required)**|
|
|
70
|
+
|`--addon` `<addon-id>`|Add-on ID or real ID|
|
|
71
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
72
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
73
|
+
|
|
74
|
+
### Examples
|
|
75
|
+
|
|
76
|
+
To create a [Better Stack](https://betterstack.com/docs/logs/http-rest-api/) drain, use the ingesting host of your source, along with its source token:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
clever drain create betterstack "https://<INGESTING_HOST>" --source-token <SOURCE_TOKEN>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## ➡️ `clever drain create datadog` <kbd>Since 0.9.0</kbd>
|
|
83
|
+
|
|
84
|
+
Create a Datadog drain
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
clever drain create datadog <drain-url> [options]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 📥 Arguments
|
|
91
|
+
|
|
92
|
+
|Name|Description|
|
|
93
|
+
|---|---|
|
|
94
|
+
|`drain-url`|Drain URL|
|
|
95
|
+
|
|
96
|
+
### ⚙️ Options
|
|
97
|
+
|
|
98
|
+
|Name|Description|
|
|
99
|
+
|---|---|
|
|
100
|
+
|`--addon` `<addon-id>`|Add-on ID or real ID|
|
|
101
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
102
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
103
|
+
|
|
104
|
+
### Examples
|
|
105
|
+
|
|
106
|
+
[Datadog](https://docs.datadoghq.com/api/?lang=python#send-logs-over-http) has two zones, EU and COM. An account on one zone is not available on the other, so make sure you target the right intake endpoint:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# EU
|
|
110
|
+
clever drain create datadog "https://http-intake.logs.datadoghq.eu/v1/input/<API_KEY>?ddsource=clevercloud&service=<SERVICE>&host=<HOST>"
|
|
111
|
+
# US
|
|
112
|
+
clever drain create datadog "https://http-intake.logs.datadoghq.com/v1/input/<API_KEY>?ddsource=clevercloud&service=<SERVICE>&host=<HOST>"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
The `host` query parameter is not mandatory: in the Datadog pipeline configuration, you can map `@source_host`, the host provided by Clever Cloud in logs, as the `host` property.
|
|
116
|
+
|
|
117
|
+
## ➡️ `clever drain create elasticsearch` <kbd>Since 0.9.0</kbd>
|
|
118
|
+
|
|
119
|
+
Create an Elasticsearch drain
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
clever drain create elasticsearch --index-prefix <index-prefix> <drain-url> [options]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### 📥 Arguments
|
|
126
|
+
|
|
127
|
+
|Name|Description|
|
|
128
|
+
|---|---|
|
|
129
|
+
|`drain-url`|Drain URL, must end with '/_bulk'|
|
|
130
|
+
|
|
131
|
+
### ⚙️ Options
|
|
132
|
+
|
|
133
|
+
|Name|Description|
|
|
134
|
+
|---|---|
|
|
135
|
+
|`-i`, `--index-prefix` `<index-prefix>`|Index prefix, indexes are created as `<index-prefix>-YYYY-MM-DD` **(required)**|
|
|
136
|
+
|`--addon` `<addon-id>`|Add-on ID or real ID|
|
|
137
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
138
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
139
|
+
|`-p`, `--password` `<password>`|Basic auth password|
|
|
140
|
+
|`-u`, `--username` `<username>`|Basic auth username|
|
|
141
|
+
|
|
142
|
+
### Examples
|
|
143
|
+
|
|
144
|
+
Elasticsearch drains use the Elastic bulk API. To match this endpoint, add `/_bulk` at the end of your Elasticsearch endpoint:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
clever drain create elasticsearch "https://<HOST>/_bulk" --index-prefix logstash --username <USERNAME> --password <PASSWORD>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`--username` and `--password` are optional, use them when your cluster requires basic authentication.
|
|
151
|
+
|
|
152
|
+
## ➡️ `clever drain create newrelic` <kbd>Since 0.9.0</kbd>
|
|
153
|
+
|
|
154
|
+
Create a New Relic drain
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
clever drain create newrelic --api-key <api-key> <drain-url> [options]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 📥 Arguments
|
|
161
|
+
|
|
162
|
+
|Name|Description|
|
|
163
|
+
|---|---|
|
|
164
|
+
|`drain-url`|Drain URL|
|
|
165
|
+
|
|
166
|
+
### ⚙️ Options
|
|
167
|
+
|
|
168
|
+
|Name|Description|
|
|
169
|
+
|---|---|
|
|
170
|
+
|`-k`, `--api-key` `<api-key>`|API key **(required)**|
|
|
171
|
+
|`--addon` `<addon-id>`|Add-on ID or real ID|
|
|
172
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
173
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
174
|
+
|
|
175
|
+
### Examples
|
|
176
|
+
|
|
177
|
+
[New Relic](https://docs.newrelic.com/docs/logs/log-api/introduction-log-api/) has two zones, EU and US. An account on one zone is not available on the other, so make sure you target the right intake endpoint:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
clever drain create newrelic "https://log-api.eu.newrelic.com/log/v1" --api-key <API_KEY>
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## ➡️ `clever drain create ovh-tcp` <kbd>Since 0.9.0</kbd>
|
|
184
|
+
|
|
185
|
+
Create an OVH TCP drain
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
clever drain create ovh-tcp <drain-url> [options]
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### 📥 Arguments
|
|
192
|
+
|
|
193
|
+
|Name|Description|
|
|
194
|
+
|---|---|
|
|
195
|
+
|`drain-url`|Drain URL|
|
|
196
|
+
|
|
197
|
+
### ⚙️ Options
|
|
198
|
+
|
|
199
|
+
|Name|Description|
|
|
200
|
+
|---|---|
|
|
201
|
+
|`--addon` `<addon-id>`|Add-on ID or real ID|
|
|
202
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
203
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
204
|
+
|`-s`, `--sd-params` `<sd-params>`|RFC5424 structured data parameters, e.g.: `token=\"REDACTED\"`|
|
|
205
|
+
|
|
206
|
+
### Examples
|
|
207
|
+
|
|
208
|
+
OVH TCP drains are syslog drains sent over TCP to an OVH Logs Data Platform endpoint. The OVH token is passed as an RFC5424 structured data parameter:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
clever drain create ovh-tcp "tcp://<HOST>:514" --sd-params 'X-OVH-TOKEN="<OVH_TOKEN>"'
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## ➡️ `clever drain create raw-http` <kbd>Since 0.9.0</kbd>
|
|
215
|
+
|
|
216
|
+
Create a raw HTTP drain
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
clever drain create raw-http <drain-url> [options]
|
|
49
220
|
```
|
|
50
221
|
|
|
51
222
|
### 📥 Arguments
|
|
52
223
|
|
|
53
224
|
|Name|Description|
|
|
54
225
|
|---|---|
|
|
55
|
-
|`drain-type`|Drain type (betterstack, datadog, elasticsearch, newrelic, ovh-tcp, raw-http, syslog-tcp, syslog-udp)|
|
|
56
226
|
|`drain-url`|Drain URL|
|
|
57
227
|
|
|
58
228
|
### ⚙️ Options
|
|
@@ -61,13 +231,108 @@ clever drain create <drain-type> <drain-url> [options]
|
|
|
61
231
|
|---|---|
|
|
62
232
|
|`--addon` `<addon-id>`|Add-on ID or real ID|
|
|
63
233
|
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
64
|
-
|`-k`, `--api-key` `<api-key>`|API key (for newrelic)|
|
|
65
234
|
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
66
|
-
|`-
|
|
67
|
-
|`-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
235
|
+
|`-p`, `--password` `<password>`|Basic auth password|
|
|
236
|
+
|`-u`, `--username` `<username>`|Basic auth username|
|
|
237
|
+
|
|
238
|
+
### Examples
|
|
239
|
+
|
|
240
|
+
Raw HTTP drains POST log batches as JSON to any HTTP endpoint. Basic authentication is optional:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
clever drain create raw-http "https://<HOST>/<PATH>"
|
|
244
|
+
clever drain create raw-http "https://<HOST>/<PATH>" --username <USERNAME> --password <PASSWORD>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
## ➡️ `clever drain create splunk` <kbd>Since 5.0.0</kbd>
|
|
248
|
+
|
|
249
|
+
Create a Splunk HEC drain
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
clever drain create splunk --hec-token <hec-token> <drain-url> [options]
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### 📥 Arguments
|
|
256
|
+
|
|
257
|
+
|Name|Description|
|
|
258
|
+
|---|---|
|
|
259
|
+
|`drain-url`|Drain URL|
|
|
260
|
+
|
|
261
|
+
### ⚙️ Options
|
|
262
|
+
|
|
263
|
+
|Name|Description|
|
|
264
|
+
|---|---|
|
|
265
|
+
|`--hec-token` `<hec-token>`|HTTP Event Collector token **(required)**|
|
|
266
|
+
|`--addon` `<addon-id>`|Add-on ID or real ID|
|
|
267
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
268
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
269
|
+
|`--index` `<index>`|Optional target index, the HEC token's own index is used if not set|
|
|
270
|
+
|`--sourcetype` `<sourcetype>`|Optional sourcetype, the HEC token's own sourcetype is used if not set|
|
|
271
|
+
|`--tls-verification` `<tls-verification>`|TLS verification mode, use `trustful` to accept a self-signed certificate (default, trustful)|
|
|
272
|
+
|
|
273
|
+
## ➡️ `clever drain create syslog-tcp` <kbd>Since 0.9.0</kbd>
|
|
274
|
+
|
|
275
|
+
Create a Syslog TCP drain
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
clever drain create syslog-tcp <drain-url> [options]
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### 📥 Arguments
|
|
282
|
+
|
|
283
|
+
|Name|Description|
|
|
284
|
+
|---|---|
|
|
285
|
+
|`drain-url`|Drain URL|
|
|
286
|
+
|
|
287
|
+
### ⚙️ Options
|
|
288
|
+
|
|
289
|
+
|Name|Description|
|
|
290
|
+
|---|---|
|
|
291
|
+
|`--addon` `<addon-id>`|Add-on ID or real ID|
|
|
292
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
293
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
294
|
+
|`-s`, `--sd-params` `<sd-params>`|RFC5424 structured data parameters, e.g.: `token=\"REDACTED\"`|
|
|
295
|
+
|
|
296
|
+
### Examples
|
|
297
|
+
|
|
298
|
+
Syslog TCP drains forward logs in the RFC5424 format, over a TCP connection. Use `--sd-params` when your collector expects structured data parameters, such as an authentication token:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
clever drain create syslog-tcp "tcp://<HOST>:<PORT>"
|
|
302
|
+
clever drain create syslog-tcp "tcp://<HOST>:<PORT>" --sd-params 'token="<TOKEN>"'
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
## ➡️ `clever drain create syslog-udp` <kbd>Since 0.9.0</kbd>
|
|
306
|
+
|
|
307
|
+
Create a Syslog UDP drain
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
clever drain create syslog-udp <drain-url> [options]
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### 📥 Arguments
|
|
314
|
+
|
|
315
|
+
|Name|Description|
|
|
316
|
+
|---|---|
|
|
317
|
+
|`drain-url`|Drain URL|
|
|
318
|
+
|
|
319
|
+
### ⚙️ Options
|
|
320
|
+
|
|
321
|
+
|Name|Description|
|
|
322
|
+
|---|---|
|
|
323
|
+
|`--addon` `<addon-id>`|Add-on ID or real ID|
|
|
324
|
+
|`-a`, `--alias` `<alias>`|Short name for the application|
|
|
325
|
+
|`--app` `<app-id\|app-name>`|Application to manage by its ID (or name, if unambiguous)|
|
|
326
|
+
|`-s`, `--sd-params` `<sd-params>`|RFC5424 structured data parameters, e.g.: `token=\"REDACTED\"`|
|
|
327
|
+
|
|
328
|
+
### Examples
|
|
329
|
+
|
|
330
|
+
Syslog UDP drains forward logs in the RFC5424 format, over UDP, which means without any delivery guarantee. Use `--sd-params` when your collector expects structured data parameters, such as an authentication token:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
clever drain create syslog-udp "udp://<HOST>:<PORT>"
|
|
334
|
+
clever drain create syslog-udp "udp://<HOST>:<PORT>" --sd-params 'token="<TOKEN>"'
|
|
335
|
+
```
|
|
71
336
|
|
|
72
337
|
## ➡️ `clever drain disable` <kbd>Since 0.9.0</kbd>
|
|
73
338
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { defineOption } from '../../lib/define-option.js';
|
|
3
|
+
|
|
4
|
+
export const drainUsernameOption = defineOption({
|
|
5
|
+
name: 'username',
|
|
6
|
+
schema: z.string().min(1).optional(),
|
|
7
|
+
description: 'Basic auth username',
|
|
8
|
+
aliases: ['u'],
|
|
9
|
+
placeholder: 'username',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const drainPasswordOption = defineOption({
|
|
13
|
+
name: 'password',
|
|
14
|
+
schema: z.string().min(1).optional(),
|
|
15
|
+
description: 'Basic auth password',
|
|
16
|
+
aliases: ['p'],
|
|
17
|
+
placeholder: 'password',
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const drainSdParamsOption = defineOption({
|
|
21
|
+
name: 'sd-params',
|
|
22
|
+
schema: z.string().min(1).optional(),
|
|
23
|
+
description: 'RFC5424 structured data parameters, e.g.: `token=\\\"REDACTED\\\"`',
|
|
24
|
+
aliases: ['s'],
|
|
25
|
+
placeholder: 'sd-params',
|
|
26
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getAllFeatures } from '../../config/features.js';
|
|
2
2
|
import { formatTable } from '../../format-table.js';
|
|
3
3
|
import { defineCommand } from '../../lib/define-command.js';
|
|
4
4
|
import { Logger } from '../../logger.js';
|
|
@@ -14,22 +14,15 @@ export const featuresListCommand = defineCommand({
|
|
|
14
14
|
async handler(options) {
|
|
15
15
|
const { format } = options;
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
// Add status from configuration file and remove instructions
|
|
19
|
-
const features = Object.entries(EXPERIMENTAL_FEATURES).map(([id, feature]) => {
|
|
20
|
-
const enabled = featuresConf[id] === true;
|
|
21
|
-
return {
|
|
22
|
-
id,
|
|
23
|
-
status: feature.status,
|
|
24
|
-
description: feature.description,
|
|
25
|
-
enabled,
|
|
26
|
-
};
|
|
27
|
-
});
|
|
17
|
+
const features = getAllFeatures();
|
|
28
18
|
|
|
29
19
|
// For each feature, print the object with the id, status, description and enabled
|
|
30
20
|
switch (format) {
|
|
31
21
|
case 'json': {
|
|
32
|
-
|
|
22
|
+
// Only expose what's relevant to the user, instructions are printed by the enable/disable commands
|
|
23
|
+
Logger.printJson(
|
|
24
|
+
features.map(({ id, status, description, enabled }) => ({ id, status, description, enabled })),
|
|
25
|
+
);
|
|
33
26
|
break;
|
|
34
27
|
}
|
|
35
28
|
case 'human':
|
|
@@ -41,7 +41,16 @@ import { domainOverviewCommand } from './domain/domain.overview.command.js';
|
|
|
41
41
|
import { domainRmCommand } from './domain/domain.rm.command.js';
|
|
42
42
|
import { drainCheckCommand } from './drain/drain.check.command.js';
|
|
43
43
|
import { drainCommand } from './drain/drain.command.js';
|
|
44
|
+
import { drainCreateBetterstackCommand } from './drain/drain.create.betterstack.command.js';
|
|
44
45
|
import { drainCreateCommand } from './drain/drain.create.command.js';
|
|
46
|
+
import { drainCreateDatadogCommand } from './drain/drain.create.datadog.command.js';
|
|
47
|
+
import { drainCreateElasticsearchCommand } from './drain/drain.create.elasticsearch.command.js';
|
|
48
|
+
import { drainCreateNewRelicCommand } from './drain/drain.create.newrelic.command.js';
|
|
49
|
+
import { drainCreateOvhTcpCommand } from './drain/drain.create.ovh-tcp.command.js';
|
|
50
|
+
import { drainCreateRawHttpCommand } from './drain/drain.create.raw-http.command.js';
|
|
51
|
+
import { drainCreateSplunkCommand } from './drain/drain.create.splunk.command.js';
|
|
52
|
+
import { drainCreateSyslogTcpCommand } from './drain/drain.create.syslog-tcp.command.js';
|
|
53
|
+
import { drainCreateSyslogUdpCommand } from './drain/drain.create.syslog-udp.command.js';
|
|
45
54
|
import { drainDisableCommand } from './drain/drain.disable.command.js';
|
|
46
55
|
import { drainEnableCommand } from './drain/drain.enable.command.js';
|
|
47
56
|
import { drainGetCommand } from './drain/drain.get.command.js';
|
|
@@ -270,7 +279,20 @@ export const globalCommands = {
|
|
|
270
279
|
drainCommand,
|
|
271
280
|
{
|
|
272
281
|
check: drainCheckCommand,
|
|
273
|
-
create:
|
|
282
|
+
create: [
|
|
283
|
+
drainCreateCommand,
|
|
284
|
+
{
|
|
285
|
+
betterstack: drainCreateBetterstackCommand,
|
|
286
|
+
datadog: drainCreateDatadogCommand,
|
|
287
|
+
elasticsearch: drainCreateElasticsearchCommand,
|
|
288
|
+
newrelic: drainCreateNewRelicCommand,
|
|
289
|
+
'ovh-tcp': drainCreateOvhTcpCommand,
|
|
290
|
+
'raw-http': drainCreateRawHttpCommand,
|
|
291
|
+
splunk: drainCreateSplunkCommand,
|
|
292
|
+
'syslog-tcp': drainCreateSyslogTcpCommand,
|
|
293
|
+
'syslog-udp': drainCreateSyslogUdpCommand,
|
|
294
|
+
},
|
|
295
|
+
],
|
|
274
296
|
disable: drainDisableCommand,
|
|
275
297
|
enable: drainEnableCommand,
|
|
276
298
|
get: drainGetCommand,
|
|
@@ -31,7 +31,7 @@ export const logsFormatOption = defineOption({
|
|
|
31
31
|
export const accessLogsFormatOption = defineOption({
|
|
32
32
|
name: 'format',
|
|
33
33
|
schema: z.enum(['human', 'json', 'json-stream', 'clf']).default('human'),
|
|
34
|
-
description: 'Output format',
|
|
34
|
+
description: 'Output format (clf only outputs HTTP access logs)',
|
|
35
35
|
aliases: ['F'],
|
|
36
36
|
placeholder: 'format',
|
|
37
37
|
});
|