loki-mode 5.42.2 → 5.43.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.
@@ -0,0 +1,579 @@
1
+ # SIEM Integration Guide
2
+
3
+ Integrate Loki Mode audit logs with Security Information and Event Management (SIEM) systems.
4
+
5
+ ## Overview
6
+
7
+ Loki Mode supports integration with enterprise SIEM systems for:
8
+
9
+ - Centralized security monitoring
10
+ - Real-time threat detection
11
+ - Compliance reporting (SOC2, HIPAA, PCI-DSS)
12
+ - Incident response
13
+ - Forensic analysis
14
+
15
+ Supported SIEM platforms:
16
+ - Splunk
17
+ - IBM QRadar
18
+ - Micro Focus ArcSight
19
+ - Elastic SIEM
20
+ - Datadog Security Monitoring
21
+ - LogRhythm
22
+ - SumoLogic
23
+
24
+ ## Syslog Forwarding (v5.38.0)
25
+
26
+ ### Enable Syslog
27
+
28
+ ```bash
29
+ export LOKI_AUDIT_SYSLOG_HOST=syslog.example.com
30
+ export LOKI_AUDIT_SYSLOG_PORT=514
31
+ export LOKI_AUDIT_SYSLOG_PROTO=udp
32
+
33
+ loki start ./prd.md
34
+ ```
35
+
36
+ ### Configuration
37
+
38
+ | Variable | Default | Description |
39
+ |----------|---------|-------------|
40
+ | `LOKI_AUDIT_SYSLOG_HOST` | - | Syslog server hostname or IP |
41
+ | `LOKI_AUDIT_SYSLOG_PORT` | `514` | Syslog server port |
42
+ | `LOKI_AUDIT_SYSLOG_PROTO` | `udp` | Protocol: `udp` or `tcp` |
43
+ | `LOKI_SYSLOG_FACILITY` | `local0` | Syslog facility (local0-local7) |
44
+ | `LOKI_SYSLOG_SEVERITY` | `info` | Minimum severity to forward |
45
+
46
+ ### Configuration File
47
+
48
+ ```yaml
49
+ # .loki/config.yaml
50
+ enterprise:
51
+ siem:
52
+ enabled: true
53
+ syslog:
54
+ host: syslog.example.com
55
+ port: 514
56
+ protocol: udp
57
+ facility: local0
58
+ severity: info
59
+ format: rfc5424 # RFC 5424 or RFC 3164
60
+ ```
61
+
62
+ ### Testing
63
+
64
+ ```bash
65
+ # Test syslog connectivity
66
+ loki syslog test
67
+
68
+ # Send test event
69
+ loki syslog test --message "Test event from Loki Mode"
70
+
71
+ # Verify on syslog server
72
+ tail -f /var/log/loki-mode.log
73
+ ```
74
+
75
+ ## Splunk Integration
76
+
77
+ ### Method 1: Splunk Universal Forwarder
78
+
79
+ ```bash
80
+ # Install Splunk Universal Forwarder
81
+ wget -O splunkforwarder.tgz 'https://download.splunk.com/...'
82
+ tar -xzf splunkforwarder.tgz
83
+ cd splunkforwarder
84
+
85
+ # Configure to monitor audit logs
86
+ ./bin/splunk add monitor ~/.loki/dashboard/audit/ \
87
+ -sourcetype loki:audit \
88
+ -index security \
89
+ -hostname $(hostname)
90
+
91
+ # Start forwarder
92
+ ./bin/splunk start
93
+ ```
94
+
95
+ ### Method 2: HTTP Event Collector (HEC)
96
+
97
+ ```bash
98
+ # Enable HEC in Splunk Web:
99
+ # Settings > Data Inputs > HTTP Event Collector > New Token
100
+
101
+ # Configure Loki Mode
102
+ export LOKI_SPLUNK_HEC_URL=https://splunk.example.com:8088/services/collector
103
+ export LOKI_SPLUNK_HEC_TOKEN=your-hec-token
104
+
105
+ # Or via config file
106
+ cat > .loki/config.yaml <<EOF
107
+ enterprise:
108
+ siem:
109
+ splunk:
110
+ hec_url: https://splunk.example.com:8088/services/collector
111
+ hec_token: your-hec-token
112
+ index: security
113
+ sourcetype: loki:audit
114
+ EOF
115
+ ```
116
+
117
+ ### Splunk Searches
118
+
119
+ ```spl
120
+ # Recent audit events
121
+ index=security sourcetype=loki:audit
122
+ | stats count by event level
123
+
124
+ # Failed authentication attempts
125
+ index=security sourcetype=loki:audit event="auth.fail"
126
+ | table timestamp actor details.reason
127
+
128
+ # High-cost sessions
129
+ index=security sourcetype=loki:audit event="session.complete"
130
+ | eval cost=tonumber('details.cost')
131
+ | where cost > 4.0
132
+ | table timestamp cost details.provider
133
+
134
+ # Agent errors
135
+ index=security sourcetype=loki:audit level=error
136
+ | stats count by event agent
137
+ ```
138
+
139
+ ## IBM QRadar Integration
140
+
141
+ ### Syslog Setup
142
+
143
+ ```bash
144
+ # Configure QRadar log source
145
+ # 1. QRadar Console > Admin > Log Sources > Add Log Source
146
+ # 2. Log Source Type: Syslog
147
+ # 3. Protocol: UDP/TCP
148
+ # 4. Port: 514
149
+
150
+ # Configure Loki Mode
151
+ export LOKI_AUDIT_SYSLOG_HOST=qradar.example.com
152
+ export LOKI_AUDIT_SYSLOG_PORT=514
153
+ export LOKI_AUDIT_SYSLOG_PROTO=tcp
154
+ ```
155
+
156
+ ### QRadar Rules
157
+
158
+ Create custom rules in QRadar:
159
+
160
+ ```
161
+ Rule: Loki Mode Authentication Failure
162
+ Event: loki:audit AND event="auth.fail"
163
+ Action: Alert, Create Offense
164
+ Severity: High
165
+
166
+ Rule: Loki Mode High Cost Session
167
+ Event: loki:audit AND event="session.complete" AND cost > 4.0
168
+ Action: Alert
169
+ Severity: Medium
170
+
171
+ Rule: Loki Mode Session Failure
172
+ Event: loki:audit AND event="session.fail"
173
+ Action: Alert, Create Offense
174
+ Severity: Medium
175
+ ```
176
+
177
+ ## Elastic SIEM Integration
178
+
179
+ ### Filebeat Setup
180
+
181
+ ```yaml
182
+ # /etc/filebeat/inputs.d/loki-audit.yml
183
+ filebeat.inputs:
184
+ - type: log
185
+ enabled: true
186
+ paths:
187
+ - /home/user/.loki/dashboard/audit/*.jsonl
188
+ json.keys_under_root: true
189
+ json.add_error_key: true
190
+ fields:
191
+ log_type: audit
192
+ application: loki-mode
193
+ environment: production
194
+ tags: ["loki", "audit", "security"]
195
+
196
+ # Elasticsearch output
197
+ output.elasticsearch:
198
+ hosts: ["https://elasticsearch.example.com:9200"]
199
+ index: "loki-audit-%{+yyyy.MM.dd}"
200
+ username: "filebeat"
201
+ password: "${ELASTICSEARCH_PASSWORD}"
202
+
203
+ # Kibana dashboards
204
+ setup.kibana:
205
+ host: "https://kibana.example.com:5601"
206
+ ```
207
+
208
+ ### Elastic Detection Rules
209
+
210
+ Create detection rules in Kibana Security:
211
+
212
+ ```
213
+ Rule: Failed Authentication Attempts
214
+ Query: event.dataset:"loki-audit" AND event:"auth.fail"
215
+ Risk Score: 50
216
+ Severity: Medium
217
+ Actions: Slack notification, Create case
218
+
219
+ Rule: Repeated Session Failures
220
+ Query: event.dataset:"loki-audit" AND event:"session.fail"
221
+ Threshold: 3 occurrences in 15 minutes
222
+ Risk Score: 75
223
+ Severity: High
224
+ Actions: PagerDuty alert, Create case
225
+
226
+ Rule: Unusual Agent Activity
227
+ Query: event.dataset:"loki-audit" AND agent.count > 50
228
+ Risk Score: 60
229
+ Severity: Medium
230
+ ```
231
+
232
+ ## ArcSight Integration
233
+
234
+ ### SmartConnector Setup
235
+
236
+ ```bash
237
+ # Install ArcSight SmartConnector for Syslog
238
+
239
+ # Configure connector.properties
240
+ agents[0].mode=syslogudp
241
+ agents[0].port=514
242
+ agents[0].parser=loki-audit
243
+
244
+ # Custom parser for Loki JSON format
245
+ # Create loki-audit.parser.properties:
246
+ parser.name=loki-audit
247
+ parser.type=json
248
+ parser.fields.timestamp=timestamp
249
+ parser.fields.event=event
250
+ parser.fields.level=level
251
+ parser.fields.actor=actor
252
+ ```
253
+
254
+ ### ArcSight CEF Format
255
+
256
+ ```bash
257
+ # Enable CEF output format
258
+ export LOKI_SYSLOG_FORMAT=cef
259
+
260
+ # CEF message example:
261
+ # CEF:0|Autonomi|Loki Mode|5.42.2|session.start|Session Started|3|
262
+ # rt=2026-02-15T14:30:00Z suser=user cs1=claude cs1Label=Provider
263
+ ```
264
+
265
+ ## Datadog Security Monitoring
266
+
267
+ ### Log Collection
268
+
269
+ ```yaml
270
+ # /etc/datadog-agent/conf.d/loki_mode.d/conf.yaml
271
+ logs:
272
+ - type: file
273
+ path: /home/user/.loki/dashboard/audit/*.jsonl
274
+ service: loki-mode
275
+ source: loki-audit
276
+ tags:
277
+ - env:production
278
+ - team:security
279
+ - compliance:soc2
280
+
281
+ # Process JSON logs
282
+ logs_config:
283
+ processing_rules:
284
+ - type: multi_line
285
+ name: log_start_with_timestamp
286
+ pattern: ^\{
287
+ ```
288
+
289
+ ### Security Signals
290
+
291
+ Create security signals in Datadog:
292
+
293
+ ```
294
+ Signal: Multiple Failed Auth Attempts
295
+ Query: source:loki-audit event:auth.fail
296
+ Threshold: > 5 in 5 minutes
297
+ Severity: High
298
+ Notifications: Slack #security, PagerDuty
299
+
300
+ Signal: High Cost Session Alert
301
+ Query: source:loki-audit event:session.complete @cost:>4.5
302
+ Severity: Medium
303
+ Notifications: Email team@example.com
304
+
305
+ Signal: Unusual Agent Spawning
306
+ Query: source:loki-audit event:agent.spawn
307
+ Threshold: > 20 in 1 minute
308
+ Severity: High
309
+ Notifications: PagerDuty, Slack #incidents
310
+ ```
311
+
312
+ ## Log Format Standards
313
+
314
+ ### RFC 5424 (Syslog Protocol)
315
+
316
+ ```
317
+ <134>1 2026-02-15T14:30:00.000Z dev-machine loki-mode 12345 - - {"event":"session.start","level":"info","actor":"user"}
318
+ ```
319
+
320
+ ### CEF (Common Event Format)
321
+
322
+ ```
323
+ CEF:0|Autonomi|Loki Mode|5.42.2|session.start|Session Started|3|rt=2026-02-15T14:30:00Z suser=user cs1=claude cs1Label=Provider
324
+ ```
325
+
326
+ ### LEEF (Log Event Extended Format)
327
+
328
+ ```
329
+ LEEF:1.0|Autonomi|Loki Mode|5.42.2|session.start|devTime=2026-02-15T14:30:00Z usrName=user provider=claude
330
+ ```
331
+
332
+ ## Event Correlation
333
+
334
+ ### Use Cases
335
+
336
+ 1. **Failed Auth + Session Start** - Potential brute force
337
+ 2. **Multiple Session Failures** - System instability
338
+ 3. **High Cost + Many Agents** - Resource abuse
339
+ 4. **Rapid Token Creation** - Possible token theft
340
+ 5. **Off-hours Activity** - Unauthorized access
341
+
342
+ ### Correlation Rules
343
+
344
+ ```yaml
345
+ # .loki/config.yaml
346
+ enterprise:
347
+ siem:
348
+ correlation_rules:
349
+ - name: "Brute Force Detection"
350
+ events:
351
+ - auth.fail
352
+ threshold: 5
353
+ window: 300 # seconds
354
+ action: alert
355
+ severity: high
356
+
357
+ - name: "Session Instability"
358
+ events:
359
+ - session.fail
360
+ threshold: 3
361
+ window: 600
362
+ action: alert
363
+ severity: medium
364
+ ```
365
+
366
+ ## Compliance Reporting
367
+
368
+ ### SOC2 Reports
369
+
370
+ ```bash
371
+ # Generate SOC2 audit report
372
+ loki enterprise audit export \
373
+ --from 2026-01-01 \
374
+ --to 2026-12-31 \
375
+ --format soc2 \
376
+ --output soc2-audit-report.pdf
377
+
378
+ # Trust Services Criteria coverage
379
+ loki compliance report --framework soc2
380
+ ```
381
+
382
+ ### HIPAA Reports
383
+
384
+ ```bash
385
+ # PHI access audit trail
386
+ loki enterprise audit search \
387
+ --event data.access \
388
+ --tag phi \
389
+ --from 2026-01-01 \
390
+ --format hipaa
391
+
392
+ # Administrative safeguards report
393
+ loki compliance report --framework hipaa --section administrative
394
+ ```
395
+
396
+ ### PCI-DSS Reports
397
+
398
+ ```bash
399
+ # User access report (Requirement 8)
400
+ loki enterprise audit search \
401
+ --event auth.token.create \
402
+ --event auth.token.revoke \
403
+ --format pci
404
+
405
+ # Audit log review (Requirement 10)
406
+ loki compliance report --framework pci --requirement 10
407
+ ```
408
+
409
+ ## Alerting
410
+
411
+ ### Critical Events
412
+
413
+ Configure immediate alerts for:
414
+
415
+ - `auth.fail` (3+ in 5 minutes)
416
+ - `session.fail` (any occurrence)
417
+ - `cost_exceeded` (budget threshold)
418
+ - `token.revoke.all` (mass revocation)
419
+ - `config.change` (production changes)
420
+
421
+ ### Alert Channels
422
+
423
+ ```yaml
424
+ enterprise:
425
+ siem:
426
+ alerts:
427
+ - event: auth.fail
428
+ threshold: 3
429
+ window: 300
430
+ channels:
431
+ - slack: "#security-alerts"
432
+ - pagerduty: "P1234567"
433
+ - email: "security@example.com"
434
+
435
+ - event: session.fail
436
+ threshold: 1
437
+ channels:
438
+ - slack: "#loki-alerts"
439
+ - email: "devops@example.com"
440
+ ```
441
+
442
+ ## Best Practices
443
+
444
+ ### Configuration
445
+
446
+ 1. Use TCP for syslog (more reliable than UDP)
447
+ 2. Enable TLS for encrypted log forwarding
448
+ 3. Set appropriate log levels (info for production)
449
+ 4. Configure log buffering for high-volume environments
450
+ 5. Test failover scenarios
451
+
452
+ ### Security
453
+
454
+ 1. Encrypt logs in transit (TLS/SSL)
455
+ 2. Encrypt logs at rest
456
+ 3. Restrict SIEM access to security team
457
+ 4. Use service accounts with minimal permissions
458
+ 5. Rotate SIEM credentials regularly
459
+
460
+ ### Performance
461
+
462
+ 1. Use log aggregation to reduce SIEM load
463
+ 2. Filter low-value events before forwarding
464
+ 3. Compress logs during transmission
465
+ 4. Monitor SIEM ingestion rates
466
+ 5. Set up log retention policies
467
+
468
+ ### Monitoring
469
+
470
+ 1. Monitor syslog connectivity
471
+ 2. Track log forwarding failures
472
+ 3. Alert on SIEM ingestion delays
473
+ 4. Review SIEM dashboards weekly
474
+ 5. Test incident response procedures quarterly
475
+
476
+ ## Troubleshooting
477
+
478
+ ### Logs Not Appearing in SIEM
479
+
480
+ ```bash
481
+ # Check syslog connectivity
482
+ nc -zv syslog.example.com 514
483
+
484
+ # Test syslog send
485
+ logger -n syslog.example.com -P 514 "Test from Loki Mode"
486
+
487
+ # Verify syslog configuration
488
+ echo $LOKI_AUDIT_SYSLOG_HOST
489
+ loki syslog test
490
+
491
+ # Check for forwarding errors
492
+ loki enterprise audit tail --event syslog.error
493
+ ```
494
+
495
+ ### Format Issues
496
+
497
+ ```bash
498
+ # Check log format
499
+ tail -f ~/.loki/dashboard/audit/audit-2026-02-15.jsonl | jq
500
+
501
+ # Verify SIEM parser configuration
502
+ # Check SIEM logs for parsing errors
503
+
504
+ # Test with manual syslog send
505
+ cat ~/.loki/dashboard/audit/audit-2026-02-15.jsonl | \
506
+ head -1 | \
507
+ logger -n syslog.example.com -P 514
508
+ ```
509
+
510
+ ### Performance Issues
511
+
512
+ ```bash
513
+ # Check log volume
514
+ find ~/.loki/dashboard/audit/ -type f -exec wc -l {} + | awk '{sum+=$1} END {print sum " total events"}'
515
+
516
+ # Monitor syslog queue
517
+ ss -tunap | grep :514
518
+
519
+ # Reduce log volume
520
+ export LOKI_AUDIT_LEVEL=warning
521
+ export LOKI_AUDIT_EXCLUDE_EVENTS=api.request,api.response
522
+ ```
523
+
524
+ ## Examples
525
+
526
+ ### Splunk Dashboard
527
+
528
+ ```xml
529
+ <dashboard>
530
+ <label>Loki Mode Security Dashboard</label>
531
+ <row>
532
+ <panel>
533
+ <title>Failed Authentications</title>
534
+ <chart>
535
+ <search>
536
+ <query>index=security sourcetype=loki:audit event="auth.fail" | timechart count</query>
537
+ </search>
538
+ </chart>
539
+ </panel>
540
+ </row>
541
+ <row>
542
+ <panel>
543
+ <title>Session Costs</title>
544
+ <chart>
545
+ <search>
546
+ <query>index=security sourcetype=loki:audit event="session.complete" | eval cost=tonumber('details.cost') | timechart avg(cost)</query>
547
+ </search>
548
+ </chart>
549
+ </panel>
550
+ </row>
551
+ </dashboard>
552
+ ```
553
+
554
+ ### Elastic Query DSL
555
+
556
+ ```json
557
+ {
558
+ "query": {
559
+ "bool": {
560
+ "must": [
561
+ {"match": {"event": "auth.fail"}},
562
+ {"range": {"timestamp": {"gte": "now-1h"}}}
563
+ ]
564
+ }
565
+ },
566
+ "aggs": {
567
+ "by_actor": {
568
+ "terms": {"field": "actor.keyword"}
569
+ }
570
+ }
571
+ }
572
+ ```
573
+
574
+ ## See Also
575
+
576
+ - [Audit Logging](audit-logging.md) - Audit logging configuration
577
+ - [Authentication Guide](authentication.md) - Authentication events
578
+ - [Enterprise Features](../wiki/Enterprise-Features.md) - Complete enterprise guide
579
+ - [Network Security](network-security.md) - Security controls
@@ -154,4 +154,4 @@ __all__ = [
154
154
  'get_startup_tips',
155
155
  ]
156
156
 
157
- __version__ = '1.2.0'
157
+ __version__ = '5.43.0'
package/mcp/__init__.py CHANGED
@@ -21,4 +21,4 @@ try:
21
21
  except ImportError:
22
22
  __all__ = ['mcp']
23
23
 
24
- __version__ = '5.42.2'
24
+ __version__ = '5.43.0'
@@ -86,6 +86,8 @@ from .namespace import (
86
86
  GLOBAL_NAMESPACE,
87
87
  )
88
88
 
89
+ __version__ = '5.43.0'
90
+
89
91
  __all__ = [
90
92
  # Embeddings
91
93
  "EmbeddingEngine",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "5.42.2",
3
+ "version": "5.43.0",
4
4
  "description": "Loki Mode by Autonomi - Multi-agent autonomous startup system for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "keywords": [
6
6
  "autonomi",
@@ -49,6 +49,7 @@
49
49
  ],
50
50
  "scripts": {
51
51
  "postinstall": "node bin/postinstall.js",
52
+ "prepack": "find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null; find . -name '*.pyc' -delete 2>/dev/null; true",
52
53
  "prepublishOnly": "cd dashboard-ui && npm ci && npm run build:all",
53
54
  "test": "bash -n autonomy/run.sh && bash -n autonomy/loki && bash -n autonomy/completion-council.sh && echo 'All syntax checks passed'",
54
55
  "test:visual": "node --experimental-vm-modules node_modules/jest/bin/jest.js dashboard-ui/tests/visual-regression.test.js",