securenow 6.0.2 → 6.1.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/CONSUMING-APPS-GUIDE.md +455 -0
- package/NPM_README.md +2029 -0
- package/README.md +297 -40
- package/SKILL-API.md +634 -0
- package/SKILL-CLI.md +454 -0
- package/cidr.js +83 -0
- package/cli/apps.js +585 -0
- package/cli/auth.js +280 -0
- package/cli/client.js +115 -0
- package/cli/config.js +173 -0
- package/cli/diagnostics.js +387 -0
- package/cli/firewall.js +100 -0
- package/cli/fp.js +638 -0
- package/cli/init.js +201 -0
- package/cli/monitor.js +440 -0
- package/cli/run.js +148 -0
- package/cli/security.js +980 -0
- package/cli/ui.js +386 -0
- package/cli/utils.js +127 -0
- package/cli.js +466 -455
- package/console-instrumentation.js +147 -136
- package/docs/ALL-FRAMEWORKS-QUICKSTART.md +1377 -455
- package/docs/API-KEYS-GUIDE.md +233 -0
- package/docs/ARCHITECTURE.md +3 -3
- package/docs/AUTO-BODY-CAPTURE.md +1 -1
- package/docs/AUTO-SETUP-SUMMARY.md +331 -0
- package/docs/AUTO-SETUP.md +4 -4
- package/docs/AUTOMATIC-IP-CAPTURE.md +5 -5
- package/docs/BODY-CAPTURE-FIX.md +261 -0
- package/docs/BODY-CAPTURE-QUICKSTART.md +2 -2
- package/docs/CHANGELOG-NEXTJS.md +1 -35
- package/docs/COMPLETION-REPORT.md +408 -0
- package/docs/CUSTOMER-GUIDE.md +16 -16
- package/docs/EASIEST-SETUP.md +5 -5
- package/docs/ENVIRONMENT-VARIABLES.md +880 -652
- package/docs/EXPRESS-BODY-CAPTURE.md +13 -12
- package/docs/EXPRESS-SETUP-GUIDE.md +719 -720
- package/docs/FINAL-SOLUTION.md +335 -0
- package/docs/FIREWALL-GUIDE.md +426 -0
- package/docs/IMPLEMENTATION-SUMMARY.md +410 -0
- package/docs/INDEX.md +22 -4
- package/docs/LOGGING-GUIDE.md +701 -708
- package/docs/LOGGING-QUICKSTART.md +234 -255
- package/docs/NEXTJS-BODY-CAPTURE-COMPARISON.md +323 -0
- package/docs/NEXTJS-BODY-CAPTURE.md +2 -2
- package/docs/NEXTJS-GUIDE.md +14 -14
- package/docs/NEXTJS-QUICKSTART.md +1 -1
- package/docs/NEXTJS-SETUP-COMPLETE.md +795 -0
- package/docs/NEXTJS-WRAPPER-APPROACH.md +1 -1
- package/docs/NUXT-GUIDE.md +166 -0
- package/docs/QUICKSTART-BODY-CAPTURE.md +2 -2
- package/docs/REDACTION-EXAMPLES.md +1 -1
- package/docs/REQUEST-BODY-CAPTURE.md +19 -10
- package/docs/SOLUTION-SUMMARY.md +312 -0
- package/docs/VERCEL-OTEL-MIGRATION.md +3 -3
- package/examples/README.md +6 -6
- package/examples/instrumentation-with-auto-capture.ts +1 -1
- package/examples/nextjs-env-example.txt +2 -2
- package/examples/nextjs-instrumentation.js +1 -1
- package/examples/nextjs-instrumentation.ts +1 -1
- package/examples/nextjs-with-logging-example.md +6 -6
- package/examples/nextjs-with-options.ts +1 -1
- package/examples/test-nextjs-setup.js +1 -1
- package/firewall-cloud.js +212 -0
- package/firewall-iptables.js +139 -0
- package/firewall-only.js +38 -0
- package/firewall-tcp.js +74 -0
- package/firewall.js +720 -0
- package/free-trial-banner.js +174 -0
- package/nextjs-auto-capture.js +199 -207
- package/nextjs-middleware.js +186 -181
- package/nextjs-webpack-config.js +88 -53
- package/nextjs-wrapper.js +158 -158
- package/nextjs.d.ts +1 -1
- package/nextjs.js +639 -647
- package/nuxt-server-plugin.mjs +423 -0
- package/nuxt.d.ts +60 -0
- package/nuxt.mjs +75 -0
- package/package.json +186 -164
- package/postinstall.js +6 -6
- package/register.d.ts +1 -1
- package/register.js +39 -4
- package/resolve-ip.js +77 -0
- package/tracing.d.ts +2 -1
- package/tracing.js +295 -34
- package/web-vite.mjs +239 -156
- package/LICENSE +0 -15
|
@@ -1,255 +1,234 @@
|
|
|
1
|
-
# SecureNow Logging - Quick Start
|
|
2
|
-
|
|
3
|
-
Get logging set up in your Node.js app in under 2 minutes!
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
console.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
[securenow]
|
|
68
|
-
[securenow]
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
---
|
|
72
|
-
|
|
73
|
-
## 5. View Logs in
|
|
74
|
-
|
|
75
|
-
1. Open your
|
|
76
|
-
2. Go to **Logs** section
|
|
77
|
-
3. Filter by `service.name = my-app`
|
|
78
|
-
4. See all your logs with automatic trace correlation!
|
|
79
|
-
|
|
80
|
-
---
|
|
81
|
-
|
|
82
|
-
## Framework-Specific Examples
|
|
83
|
-
|
|
84
|
-
### Express.js
|
|
85
|
-
|
|
86
|
-
```javascript
|
|
87
|
-
// app.js
|
|
88
|
-
require('securenow/register');
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
body: 'Custom log message',
|
|
236
|
-
attributes: {
|
|
237
|
-
customField: 'value',
|
|
238
|
-
},
|
|
239
|
-
});
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
---
|
|
243
|
-
|
|
244
|
-
## Next Steps
|
|
245
|
-
|
|
246
|
-
- [Complete Logging Guide](./LOGGING-GUIDE.md) - All features and options
|
|
247
|
-
- [View Logs in SigNoz](https://signoz.io/docs/logs-management/overview/)
|
|
248
|
-
- [Set Up Log Alerts](https://signoz.io/docs/alerts-management/log-based-alerts/)
|
|
249
|
-
- [Combine with Tracing](../README.md) - Full observability
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
**That's it!** 🎉 Your app is now sending logs to SigNoz.
|
|
254
|
-
|
|
255
|
-
Need help? Check the [full documentation](./LOGGING-GUIDE.md) or open an issue.
|
|
1
|
+
# SecureNow Logging - Quick Start
|
|
2
|
+
|
|
3
|
+
Get logging set up in your Node.js app in under 2 minutes!
|
|
4
|
+
|
|
5
|
+
**Since v5.6.0:** When `SECURENOW_LOGGING_ENABLED=1` is set, all `console.log` / `warn` / `error` / `info` / `debug` calls are automatically forwarded as OTLP log records. You only need `require('securenow/register')`—a separate `console-instrumentation` preload is no longer required.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install securenow
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. Configure Environment
|
|
18
|
+
|
|
19
|
+
Create `.env` file or export variables:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
SECURENOW_LOGGING_ENABLED=1
|
|
23
|
+
SECURENOW_APPID=my-app
|
|
24
|
+
SECURENOW_INSTANCE=http://your-otlp-backend:4318
|
|
25
|
+
|
|
26
|
+
# For SecureNow / hosted OTLP (example):
|
|
27
|
+
# SECURENOW_INSTANCE=https://freetrial.securenow.ai:4318
|
|
28
|
+
# OTEL_EXPORTER_OTLP_HEADERS="x-api-key=<your-key>"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 3. Add to Your App
|
|
34
|
+
|
|
35
|
+
**Option A: Automatic Console Logging (Easiest)**
|
|
36
|
+
|
|
37
|
+
Add this line at the top of your main file:
|
|
38
|
+
|
|
39
|
+
```javascript
|
|
40
|
+
// app.js, index.js, server.js, or main.ts
|
|
41
|
+
require('securenow/register');
|
|
42
|
+
|
|
43
|
+
// That's it! Now use console normally
|
|
44
|
+
console.log('App started');
|
|
45
|
+
console.error('An error occurred', { userId: 123 });
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Option B: Use NODE_OPTIONS (No code changes)**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
NODE_OPTIONS="-r securenow/register" node app.js
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 4. Run Your App
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
node app.js
|
|
60
|
+
# or
|
|
61
|
+
npm start
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
You should see:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
[securenow] OTel SDK started → http://your-otlp-backend:4318/v1/traces
|
|
68
|
+
[securenow] 📋 Logging: ENABLED → http://your-otlp-backend:4318/v1/logs
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## 5. View Logs in SecureNow
|
|
74
|
+
|
|
75
|
+
1. Open your SecureNow dashboard
|
|
76
|
+
2. Go to **Logs** section
|
|
77
|
+
3. Filter by `service.name = my-app`
|
|
78
|
+
4. See all your logs with automatic trace correlation!
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Framework-Specific Examples
|
|
83
|
+
|
|
84
|
+
### Express.js
|
|
85
|
+
|
|
86
|
+
```javascript
|
|
87
|
+
// app.js
|
|
88
|
+
require('securenow/register');
|
|
89
|
+
|
|
90
|
+
const express = require('express');
|
|
91
|
+
const app = express();
|
|
92
|
+
|
|
93
|
+
app.get('/', (req, res) => {
|
|
94
|
+
console.log('Request received');
|
|
95
|
+
res.send('Hello World');
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
app.listen(3000);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Next.js
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
// instrumentation.ts (in project root)
|
|
105
|
+
export async function register() {
|
|
106
|
+
if (process.env.NEXT_RUNTIME === 'nodejs') {
|
|
107
|
+
process.env.SECURENOW_LOGGING_ENABLED = '1';
|
|
108
|
+
await import('securenow/register');
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# .env.local
|
|
115
|
+
SECURENOW_LOGGING_ENABLED=1
|
|
116
|
+
SECURENOW_APPID=my-nextjs-app
|
|
117
|
+
SECURENOW_INSTANCE=http://localhost:4318
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Fastify
|
|
121
|
+
|
|
122
|
+
```javascript
|
|
123
|
+
// server.js
|
|
124
|
+
require('securenow/register');
|
|
125
|
+
|
|
126
|
+
const fastify = require('fastify')();
|
|
127
|
+
|
|
128
|
+
fastify.get('/', async () => {
|
|
129
|
+
console.log('Route called');
|
|
130
|
+
return { hello: 'world' };
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
fastify.listen({ port: 3000 });
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### NestJS
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
// main.ts
|
|
140
|
+
require('securenow/register');
|
|
141
|
+
|
|
142
|
+
import { NestFactory } from '@nestjs/core';
|
|
143
|
+
import { AppModule } from './app.module';
|
|
144
|
+
|
|
145
|
+
async function bootstrap() {
|
|
146
|
+
const app = await NestFactory.create(AppModule);
|
|
147
|
+
console.log('App starting');
|
|
148
|
+
await app.listen(3000);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
bootstrap();
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Troubleshooting
|
|
157
|
+
|
|
158
|
+
**Logs not appearing?**
|
|
159
|
+
|
|
160
|
+
1. Check `SECURENOW_LOGGING_ENABLED=1` is set
|
|
161
|
+
2. Verify your OTLP / SecureNow endpoint is correct
|
|
162
|
+
3. Enable debug: `OTEL_LOG_LEVEL=debug`
|
|
163
|
+
|
|
164
|
+
**Console logs not forwarding?**
|
|
165
|
+
|
|
166
|
+
Load `securenow/register` before other app code so logging hooks run first:
|
|
167
|
+
|
|
168
|
+
```javascript
|
|
169
|
+
// ✅ Correct
|
|
170
|
+
require('securenow/register'); // First
|
|
171
|
+
|
|
172
|
+
// ❌ Wrong
|
|
173
|
+
require('express');
|
|
174
|
+
require('securenow/register'); // Too late!
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## What Gets Logged?
|
|
180
|
+
|
|
181
|
+
All standard console methods:
|
|
182
|
+
|
|
183
|
+
- `console.log()` → INFO
|
|
184
|
+
- `console.info()` → INFO
|
|
185
|
+
- `console.warn()` → WARN
|
|
186
|
+
- `console.error()` → ERROR
|
|
187
|
+
- `console.debug()` → DEBUG
|
|
188
|
+
|
|
189
|
+
**Structured logging example:**
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
console.log('User logged in', {
|
|
193
|
+
userId: 123,
|
|
194
|
+
email: 'user@example.com',
|
|
195
|
+
ip: '192.168.1.1'
|
|
196
|
+
});
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
This creates a log with attributes you can filter/search in SecureNow!
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
## Advanced Usage
|
|
204
|
+
|
|
205
|
+
**Direct Logger API:**
|
|
206
|
+
|
|
207
|
+
```javascript
|
|
208
|
+
const { getLogger } = require('securenow/tracing');
|
|
209
|
+
const logger = getLogger('my-module', '1.0.0');
|
|
210
|
+
|
|
211
|
+
logger.emit({
|
|
212
|
+
severityNumber: 9,
|
|
213
|
+
severityText: 'INFO',
|
|
214
|
+
body: 'Custom log message',
|
|
215
|
+
attributes: {
|
|
216
|
+
customField: 'value',
|
|
217
|
+
},
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## Next Steps
|
|
224
|
+
|
|
225
|
+
- [Complete Logging Guide](./LOGGING-GUIDE.md) - All features and options
|
|
226
|
+
- [SecureNow](https://securenow.ai/)
|
|
227
|
+
- [Documentation](./INDEX.md)
|
|
228
|
+
- [Combine with Tracing](../README.md) - Full observability
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
**That's it!** 🎉 Your app is now sending logs to SecureNow.
|
|
233
|
+
|
|
234
|
+
Need help? Check the [full documentation](./LOGGING-GUIDE.md) or open an issue.
|