spath
Copy a nested value from an event's unmapped source fields into a new column.
Use spath to copy a nested value into a column you can use later in your pipeline. By default, it reads unmapped, which holds source fields with no OCSF home; see OCSF schema.
Syntax
... | spath [input=<field>] path=<path> [output=<field>]| Argument | Default | Description |
|---|---|---|
input | unmapped | Object or JSON-text field to read. |
path | Dotted path under the input, for example request_parameters.bucket_name. | |
output | spath_result | Name of the new column. |
How it works
spath path=a.breadsunmapped.a.band writes it, as a string, to theoutputcolumn. The original field is unchanged.spathwithoutpath=does nothing.- The path is a dotted name. Array indexes such as
items[0].nameare not supported and are a syntax error.
You can also query the same value directly, without spath: unmapped.request_parameters.bucket_name="acme-prod-data". Use spath when you want a short column name for the rest of the pipeline.
Examples
S3 buckets named in CloudTrail request parameters:
metadata.log_source=aws_cloudtrail | spath path=request_parameters.bucket_name output=bucket | where isnotnull(bucket) | stats count by bucketThe same result without spath:
metadata.log_source=aws_cloudtrail unmapped.request_parameters.bucket_name=* | stats count by unmapped.request_parameters.bucket_nameIAM roles assumed, with the session name:
metadata.log_source=aws_cloudtrail api.operation=AssumeRole | spath path=request_parameters.role_arn output=role | spath path=request_parameters.role_session_name output=session | table time, actor.user.name, role, session