@stackone/olap 1.81.1 → 2.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/README.md CHANGED
@@ -49,6 +49,43 @@ $ pnpm lint
49
49
  $ pnpm lint:fix
50
50
  ```
51
51
 
52
+ ## Where advanced, defender and policy logs are stored
53
+
54
+ The advanced, defender and policy sinks write through [`@stackone/storage`](../storage/README.md), so
55
+ the same build stores them in S3, MinIO or GCS depending on where it is deployed. olap has no AWS SDK
56
+ dependency of its own.
57
+
58
+ ```ts
59
+ import { OlapClientManager } from '@stackone/olap';
60
+ import { createStorage, storageConfigFromEnv } from '@stackone/storage';
61
+
62
+ const olap = await OlapClientManager.getInstance({
63
+ storage: createStorage(storageConfigFromEnv()),
64
+ sinkConfig: {
65
+ advanced: { bucket: process.env.ADVANCED_LOGS_BUCKET },
66
+ defender: { bucket: process.env.DEFENDER_LOGS_BUCKET },
67
+ policy: { bucket: process.env.POLICY_LOGS_BUCKET },
68
+ },
69
+ // ...
70
+ });
71
+ ```
72
+
73
+ `storage` is optional. Leave it out and olap builds `createStorage(storageConfigFromEnv())` itself,
74
+ but only when one of those sinks has a bucket, so a service that stores nothing never reads a storage
75
+ config. Passing it is how a service tunes retries and timeouts for these writes.
76
+
77
+ Each log is JSON with a `ttl` tag (`1d`, `7d` or `30d` for advanced logs; the sink's `ttlDays` for
78
+ defender and policy) and an `expiresAt`, so bucket lifecycle rules can expire it on every cloud — by
79
+ tag on S3 and MinIO, by `daysSinceCustomTime` on GCS.
80
+
81
+ ### Upgrading from 1.x
82
+
83
+ `getS3Client` and `s3ClientConfig` are gone; pass `storage` instead. Object keys, bodies, tags and
84
+ expiry are unchanged, so in the same S3 or MinIO bucket logs written by 1.x read back under 2.x and
85
+ the other way round. 1.x only ever reaches S3, so it cannot read what 2.x stores in GCS. Failures
86
+ reaching a caller are `StorageError`s from `@stackone/storage`, with the SDK's error on `cause`,
87
+ rather than raw AWS SDK errors.
88
+
52
89
  ## Platform logs
53
90
 
54
91
  Platform logs are the audit trail of operations on StackOne itself — creating an account, deleting