Security Lake¶
securitylake
¶
AWS Security Lake packaging for OCSF Detection Findings.
Security Lake custom sources must deliver Parquet objects (not JSON), partitioned in S3 by region / account / event-day, with records sorted by time. This module turns validated findings into a Parquet byte payload and computes the S3 object key. It does NOT talk to S3 -- the caller uploads the bytes at the returned key, keeping transport out of the package (see README).
Requirements implemented (per the Security Lake custom-source docs):
* Apache Parquet, zstandard compression.
* Data page size <= 1 MB (uncompressed); row group size <= 256 MB.
* Records sorted by time within each object.
* Partition prefix: ext/{source}/region={r}/accountId={a}/eventDay={YYYYMMDD}/.
This module requires the securitylake extra (pyarrow):
uv pip install -e ".[securitylake]"
ParquetObject
dataclass
¶
A ready-to-upload Security Lake object: Parquet data at S3 key.
partition_prefix
¶
Build the Security Lake S3 partition prefix.
ext/{source_location}/region={region}/accountId={account_id}/eventDay={event_day}/
Source code in src/ocsf_emitter/securitylake.py
event_day_from_ms
¶
Convert an epoch-ms timestamp to a Security Lake eventDay (UTC YYYYMMDD).
to_parquet_bytes
¶
Validate, sort by time, and serialize findings to a Parquet byte string.
Source code in src/ocsf_emitter/securitylake.py
build_parquet_object
¶
build_parquet_object(
findings: Sequence[DetectionFinding],
*,
source_location: str,
region: str,
account_id: str,
object_name: str,
event_day: str | None = None,
) -> ParquetObject
Package findings into a single Security Lake Parquet object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
findings
|
Sequence[DetectionFinding]
|
One or more validated-on-emit detection findings. All should
share an event day; |
required |
source_location
|
str
|
The unique prefix Security Lake assigned to this source. |
required |
region
|
str
|
AWS region the data is uploaded to (e.g. |
required |
account_id
|
str
|
AWS account id the records pertain to (or |
required |
object_name
|
str
|
File name for the object ( |
required |
event_day
|
str | None
|
|
None
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
ParquetObject
|
class: |