ez_logs_agent 0.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.
data/FAQ.md ADDED
@@ -0,0 +1,574 @@
1
+ # EZLogs Agent — Frequently Asked Questions
2
+
3
+ Common questions about EZLogs Agent.
4
+
5
+ ---
6
+
7
+ ## General
8
+
9
+ ### What is EZLogs?
10
+
11
+ EZLogs transforms technical system activity into human-readable stories that anyone on your team can understand.
12
+
13
+ Instead of scattered logs across multiple tools, you see complete activity stories:
14
+ - What happened
15
+ - Who triggered it
16
+ - What succeeded or failed
17
+ - All in plain language
18
+
19
+ See [README.md](README.md) for the full overview.
20
+
21
+ ---
22
+
23
+ ### How is EZLogs different from Datadog/New Relic/CloudWatch?
24
+
25
+ **EZLogs is for understanding. Monitoring tools are for debugging.**
26
+
27
+ | Tool | Purpose | Audience |
28
+ |------|---------|----------|
29
+ | **EZLogs** | What happened in the system (business understanding) | Everyone (support, product, founders) |
30
+ | **Datadog** | Performance monitoring, metrics, traces | Engineers |
31
+ | **New Relic** | APM, performance bottlenecks | Engineers |
32
+ | **CloudWatch** | Infrastructure monitoring, logs | Engineers, DevOps |
33
+
34
+ EZLogs complements these tools—it doesn't replace them. Engineers still use monitoring tools for debugging. EZLogs lets everyone else understand what's happening.
35
+
36
+ ---
37
+
38
+ ### Is EZLogs an audit log?
39
+
40
+ **No.** EZLogs is best-effort, not guaranteed delivery.
41
+
42
+ For compliance and legal requirements, use:
43
+ - **PaperTrail** — Audit trail gem for Rails
44
+ - **Audited** — ActiveRecord auditing
45
+ - **LogDNA/Loggly** — Compliant log aggregation
46
+
47
+ EZLogs prioritizes understanding over completeness. Some events may be dropped if the server is unreachable. This is intentional.
48
+
49
+ ---
50
+
51
+ ### Can I use EZLogs for compliance (SOC 2, HIPAA, etc.)?
52
+
53
+ **No.** EZLogs is not designed for compliance requirements.
54
+
55
+ Compliance requires:
56
+ - Guaranteed event delivery
57
+ - Immutable logs
58
+ - Long-term retention
59
+ - Tamper-proof storage
60
+
61
+ EZLogs is best-effort and designed for operational visibility, not legal compliance.
62
+
63
+ ---
64
+
65
+ ## Installation & Setup
66
+
67
+ ### What are the requirements?
68
+
69
+ - **Ruby** >= 3.1.0
70
+ - **Rails** application (any recent version)
71
+ - **Sidekiq** or **ActiveJob** (optional, for job capture)
72
+ - **ActiveRecord** (optional, for database capture)
73
+
74
+ That's it. No other dependencies.
75
+
76
+ ---
77
+
78
+ ### Do I need to modify my application code?
79
+
80
+ **No.** EZLogs Agent self-configures via Rails Railtie.
81
+
82
+ Just:
83
+ 1. Add the gem
84
+ 2. Run the generator
85
+ 3. Configure server URL and API key
86
+ 4. Restart your app
87
+
88
+ No code changes, no middleware registration, no monkey patching required.
89
+
90
+ ---
91
+
92
+ ### Will EZLogs slow down my application?
93
+
94
+ **No.** The agent is designed to be invisible:
95
+
96
+ - **Event capture:** Synchronous but extremely fast (microseconds)
97
+ - **Sending events:** Asynchronous via background thread (zero latency added to requests)
98
+ - **Memory:** ~1-2MB for default buffer size
99
+
100
+ **Performance impact:** Negligible. You won't notice it.
101
+
102
+ ---
103
+
104
+ ###Can I use this in production?
105
+
106
+ **Yes.** EZLogs Agent is production-ready:
107
+
108
+ - 685+ tests covering all scenarios
109
+ - Comprehensive error handling
110
+ - Never blocks or crashes your application
111
+ - Fails gracefully if server is unreachable
112
+
113
+ It's designed to be safe and reliable.
114
+
115
+ ---
116
+
117
+ ## Behavior & Data
118
+
119
+ ### Are events guaranteed to be delivered?
120
+
121
+ **No.** EZLogs is best-effort, not guaranteed delivery.
122
+
123
+ Events may be dropped if:
124
+ - EZLogs server is unreachable
125
+ - Network connection fails after retries
126
+ - Buffer overflows (too many events)
127
+
128
+ **This is intentional.** Your application's reliability is more important than capturing every event.
129
+
130
+ ---
131
+
132
+ ### Can events arrive out of order?
133
+
134
+ **Yes.** Events are sent asynchronously and may arrive out of order.
135
+
136
+ EZLogs Server uses timestamps to reconstruct the correct timeline, but there's no strict ordering guarantee.
137
+
138
+ ---
139
+
140
+ ### What happens if events are dropped?
141
+
142
+ **Your application continues normally.** Dropped events are logged as warnings:
143
+
144
+ ```
145
+ [EzLogsAgent] Buffer full, dropping oldest events
146
+ [EzLogsAgent] Failed to send events after 3 retries, dropping batch
147
+ ```
148
+
149
+ You'll see gaps in your activity log, but your app keeps running.
150
+
151
+ ---
152
+
153
+ ### How long does correlation last?
154
+
155
+ **Correlation lasts for the lifetime of a user action.**
156
+
157
+ Example:
158
+ 1. HTTP request generates `correlation_id: "req_abc123"`
159
+ 2. Background jobs enqueued from that request inherit `"req_abc123"`
160
+ 3. Database changes within those jobs also get `"req_abc123"`
161
+ 4. Jobs enqueued from those jobs also inherit `"req_abc123"`
162
+
163
+ **Correlation ends when:**
164
+ - Jobs complete
165
+ - Cron jobs start (new correlation)
166
+ - Console operations (no correlation)
167
+
168
+ ---
169
+
170
+ ### What if correlation is missing?
171
+
172
+ **This is expected and acceptable.**
173
+
174
+ Some events have no correlation:
175
+ - Cron jobs
176
+ - Console operations
177
+ - Database callbacks outside request/job context
178
+
179
+ These events still appear in your log—they just won't be grouped with other events.
180
+
181
+ **Design principle:** Missing data is acceptable; wrong data is not. The agent never guesses correlation IDs.
182
+
183
+ ---
184
+
185
+ ## Data & Privacy
186
+
187
+ ### What data does EZLogs capture?
188
+
189
+ **HTTP requests:**
190
+ - Method, path, status code, duration
191
+ - Controller and action name
192
+ - GraphQL operation name (queries, mutations, subscriptions)
193
+ - Request parameters (sanitized)
194
+
195
+ **Background jobs:**
196
+ - Job class, queue, duration
197
+ - Success/failure status
198
+ - Error message (if failed)
199
+ - Job arguments (sanitized)
200
+
201
+ **Database changes:**
202
+ - Model class, record ID, operation type
203
+ - Attribute changes (for updates)
204
+
205
+ **NOT captured:**
206
+ - Request bodies (except params)
207
+ - Response bodies
208
+ - Session data
209
+ - Cookies
210
+ - SELECT queries
211
+
212
+ ---
213
+
214
+ ### Does EZLogs capture request bodies?
215
+
216
+ **No, not directly.** Only request parameters are captured (e.g., `params` hash in Rails).
217
+
218
+ **Sanitization:** Sensitive parameters are automatically redacted:
219
+ - `password`
220
+ - `token`
221
+ - `secret`
222
+ - `api_key`
223
+ - `credit_card`
224
+
225
+ See [README.md#what-gets-captured](README.md#what-gets-captured) for details.
226
+
227
+ ---
228
+
229
+ ### Does EZLogs capture database field values?
230
+
231
+ **Only for updates, and only one meaningful field.**
232
+
233
+ For updates, the agent captures one attribute change:
234
+ - `status: pending → shipped`
235
+ - `email: old@example.com → new@example.com`
236
+
237
+ This is enough to understand what changed without capturing all data.
238
+
239
+ **NOT captured:**
240
+ - All field values
241
+ - Sensitive fields (password, token, etc.)
242
+ - Binary data
243
+
244
+ ---
245
+
246
+ ### How do I prevent sensitive data from being sent?
247
+
248
+ **1. Exclude sensitive paths:**
249
+ ```ruby
250
+ config.excluded_paths = ["/admin*", "/internal*"]
251
+ ```
252
+
253
+ **2. Exclude sensitive tables:**
254
+ ```ruby
255
+ config.excluded_tables = ["credit_cards", "ssn_data"]
256
+ ```
257
+
258
+ **3. Disable specific capture types:**
259
+ ```ruby
260
+ config.capture_database = false # Don't capture DB changes
261
+ ```
262
+
263
+ **4. Sensitive params are auto-redacted:**
264
+ The agent automatically redacts params named:
265
+ - `password`, `token`, `secret`, `api_key`, `credit_card`
266
+
267
+ ---
268
+
269
+ ## Performance
270
+
271
+ ### What's the memory overhead?
272
+
273
+ **Default configuration:** ~1-2MB
274
+
275
+ This is from the event buffer (10,000 events by default).
276
+
277
+ **To reduce (low-volume apps):**
278
+ ```ruby
279
+ config.buffer_size = 5000 # ~500KB-1MB
280
+ ```
281
+
282
+ **To increase (very high-traffic apps):**
283
+ ```ruby
284
+ config.buffer_size = 20000 # ~2-4MB
285
+ ```
286
+
287
+ ---
288
+
289
+ ### How many events can be buffered?
290
+
291
+ **Default:** 10,000 events
292
+
293
+ When the buffer is full, oldest events are dropped (circular buffer).
294
+
295
+ **To adjust:**
296
+ ```ruby
297
+ config.buffer_size = 20000 # For very high-volume apps
298
+ ```
299
+
300
+ ---
301
+
302
+ ### Will this cause memory leaks?
303
+
304
+ **No.** The buffer is fixed-size and circular.
305
+
306
+ Memory usage is bounded by:
307
+ ```
308
+ memory = buffer_size × average_event_size
309
+ ```
310
+
311
+ Even if events aren't sent (server down), memory won't grow unbounded.
312
+
313
+ ---
314
+
315
+ ### What if my app generates millions of events?
316
+
317
+ **The agent is designed for this:**
318
+
319
+ 1. **Buffer overflow protection** — Oldest events are dropped when buffer is full
320
+ 2. **Batched sending** — Events sent every 3 seconds by default (configurable)
321
+ 3. **Async processing** — Never blocks your application
322
+
323
+ **Default settings already optimized for high-volume.** To tune further:
324
+ ```ruby
325
+ config.buffer_size = 20000 # Even larger buffer (if needed)
326
+ config.send_interval = 2 # Even more frequent sends
327
+ config.excluded_paths = [...] # Filter noise
328
+ ```
329
+
330
+ ---
331
+
332
+ ## Configuration
333
+
334
+ ### Do I need to configure actor context?
335
+
336
+ **No, it's optional.**
337
+
338
+ Without actor context, events are captured with `actor: null`. You'll still see what happened, just not who triggered it.
339
+
340
+ **When to configure it:**
341
+ - You want to know who triggered each action
342
+ - You have user authentication (Devise, Clearance, custom)
343
+ - Attribution matters for your use case
344
+
345
+ See [CONFIGURATION.md#actor-context](CONFIGURATION.md#actor-context) for setup.
346
+
347
+ ---
348
+
349
+ ### How do I exclude sensitive paths?
350
+
351
+ ```ruby
352
+ config.excluded_paths = ["/admin*", "/internal*"]
353
+ ```
354
+
355
+ Use `*` suffix for prefix matching:
356
+ - `/admin*` matches `/admin`, `/admin/users`, etc.
357
+
358
+ See [CONFIGURATION.md#excluded_paths](CONFIGURATION.md#excluded-paths) for details.
359
+
360
+ ---
361
+
362
+ ### What happens if EZLogs server is down?
363
+
364
+ **Your application continues running normally.**
365
+
366
+ The agent:
367
+ 1. Retries sending (with exponential backoff)
368
+ 2. Logs warnings
369
+ 3. Drops events after max retries
370
+ 4. Never crashes or blocks your app
371
+
372
+ **Your app is always the priority.**
373
+
374
+ ---
375
+
376
+ ### Can I send events to multiple servers?
377
+
378
+ **No, not directly.** The agent only supports one `server_url`.
379
+
380
+ **Workarounds:**
381
+ - Run multiple Rails instances with different configs
382
+ - Use a load balancer to route to multiple EZLogs servers
383
+ - Contact support@ezlogs.com for enterprise multi-region setups
384
+
385
+ ---
386
+
387
+ ## Debugging
388
+
389
+ ### How do I know if it's working?
390
+
391
+ **Run the connection test:**
392
+ ```bash
393
+ rails ez_logs_agent:test_connection
394
+ ```
395
+
396
+ This verifies:
397
+ - Configuration is valid
398
+ - Server is reachable
399
+ - Authentication works
400
+ - Events are being accepted
401
+
402
+ ---
403
+
404
+ ### Where can I see agent errors?
405
+
406
+ **Check Rails logs:**
407
+ ```
408
+ [EzLogsAgent] Agent initialized successfully
409
+ [EzLogsAgent] Sending batch of 5 events...
410
+ [EzLogsAgent] Batch sent successfully (HTTP 200)
411
+ ```
412
+
413
+ **For errors:**
414
+ ```
415
+ [EzLogsAgent] Failed to send events (HTTP 401)
416
+ [EzLogsAgent] Failed to send events (timeout)
417
+ ```
418
+
419
+ ---
420
+
421
+ ### How do I enable debug logging?
422
+
423
+ ```ruby
424
+ # config/initializers/ez_logs_agent.rb
425
+ config.log_level = :debug
426
+ ```
427
+
428
+ Then restart Rails. You'll see detailed output:
429
+ ```
430
+ [EzLogsAgent] Captured HTTP event: GET /users (200, 45ms)
431
+ [EzLogsAgent] Captured Database event: User#create (id: 123)
432
+ [EzLogsAgent] Buffer: 12 events
433
+ [EzLogsAgent] Sending batch of 12 events...
434
+ ```
435
+
436
+ **Warning:** Debug mode is verbose. Use it for troubleshooting only.
437
+
438
+ ---
439
+
440
+ ### Events aren't showing up. What do I check?
441
+
442
+ 1. **Run connection test:**
443
+ ```bash
444
+ rails ez_logs_agent:test_connection
445
+ ```
446
+
447
+ 2. **Check Rails logs** for agent messages
448
+
449
+ 3. **Enable debug logging:**
450
+ ```ruby
451
+ config.log_level = :debug
452
+ ```
453
+
454
+ 4. **Verify configuration:**
455
+ - `server_url` is correct
456
+ - `project_token` is valid
457
+ - Rails was restarted after config changes
458
+
459
+ See [README.md#troubleshooting](README.md#troubleshooting) for detailed steps.
460
+
461
+ ---
462
+
463
+ ## Compatibility
464
+
465
+ ### Does this work with Rails API-only apps?
466
+
467
+ **Yes.** The agent works with Rails API-only mode.
468
+
469
+ - HTTP capture: ✅ Works
470
+ - Job capture: ✅ Works
471
+ - Database capture: ✅ Works
472
+ - Actor context: ⚠️ Requires custom extraction (no `controller.current_user`)
473
+
474
+ ---
475
+
476
+ ### Does this work with Grape/Sinatra/other Rack apps?
477
+
478
+ **Partially.** The agent is designed for Rails but may work with other Rack apps:
479
+
480
+ - HTTP capture: ✅ Works (Rack middleware)
481
+ - Job capture: ✅ Works (if using Sidekiq/ActiveJob)
482
+ - Database capture: ✅ Works (if using ActiveRecord)
483
+ - Auto-configuration: ❌ No Rails Railtie (manual setup required)
484
+
485
+ **For non-Rails apps,** contact support@ezlogs.com
486
+
487
+ ---
488
+
489
+ ### Does this work with Resque/Delayed::Job/Que?
490
+
491
+ **Only Sidekiq and ActiveJob are supported currently.**
492
+
493
+ Planned future support:
494
+ - Resque
495
+ - Delayed::Job
496
+ - Que
497
+
498
+ See [docs/agent/roadmap.md](../docs/agent/roadmap.md) for the roadmap.
499
+
500
+ ---
501
+
502
+ ### Does this work with Sequel/ROM/other ORMs?
503
+
504
+ **No, only ActiveRecord is supported.**
505
+
506
+ Database capture requires ActiveRecord callbacks.
507
+
508
+ ---
509
+
510
+ ## Pricing & Licensing
511
+
512
+ ### Is EZLogs free?
513
+
514
+ See pricing at [your-ezlogs-server.com/pricing](https://your-ezlogs-server.com/pricing)
515
+
516
+ The agent gem is open-source (MIT license). The hosted EZLogs server is a paid SaaS service.
517
+
518
+ ---
519
+
520
+ ### What's the license?
521
+
522
+ **MIT License.** See [LICENSE.txt](LICENSE.txt)
523
+
524
+ You can use EZLogs Agent freely in commercial and open-source projects.
525
+
526
+ ---
527
+
528
+ ### Can I self-host the EZLogs server?
529
+
530
+ **The server code is in this repository,** but it's not officially supported for self-hosting.
531
+
532
+ For self-hosting questions, contact support@ezlogs.com
533
+
534
+ ---
535
+
536
+ ## Support
537
+
538
+ ### How do I report a bug?
539
+
540
+ 1. Check [GitHub Issues](https://github.com/your-org/ez_logs/issues) for existing reports
541
+ 2. Open a new issue with:
542
+ - Clear description
543
+ - Steps to reproduce
544
+ - Expected vs actual behavior
545
+ - Rails version, Ruby version
546
+ - Output of `rails ez_logs_agent:test_connection`
547
+
548
+ ---
549
+
550
+ ### How do I request a feature?
551
+
552
+ Open a [GitHub Issue](https://github.com/your-org/ez_logs/issues) or start a [GitHub Discussion](https://github.com/your-org/ez_logs/discussions).
553
+
554
+ ---
555
+
556
+ ### Where do I get help?
557
+
558
+ - **Documentation:** [README.md](README.md), [CONFIGURATION.md](CONFIGURATION.md), [QUICKSTART.md](QUICKSTART.md)
559
+ - **GitHub Issues:** [Report bugs and request features](https://github.com/your-org/ez_logs/issues)
560
+ - **Email:** support@ezlogs.com (for customers)
561
+
562
+ ---
563
+
564
+ ## Still have questions?
565
+
566
+ - [README.md](README.md) — Full documentation
567
+ - [QUICKSTART.md](QUICKSTART.md) — Getting started guide
568
+ - [CONFIGURATION.md](CONFIGURATION.md) — Configuration reference
569
+ - [GitHub Issues](https://github.com/your-org/ez_logs/issues) — Report bugs
570
+ - [Email support](mailto:support@ezlogs.com) — For customers
571
+
572
+ ---
573
+
574
+ **Can't find your answer?** [Open an issue](https://github.com/your-org/ez_logs/issues) or email support@ezlogs.com
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 dezsirazvan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.