Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
{
"name": "dedup_metrics_size_field",
"operation-type": "search",
"index": "{{index_name | default('custom-big5')}}",
"body": {
"query": {
"exists": {
"field": "metrics.size",
"boost": 1.0
}
},
"_source": {
"includes": ["agent", "process", "log", "message", "tags", "cloud", "input", "@timestamp", "ecs", "data_stream", "meta", "host", "metrics", "metrics.size", "aws", "event"],
"excludes": []
}
}
}
*/
source = custom-big5
| dedup `metrics.size`
| sort - `@timestamp`
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
{
"name": "parse_field_with_cast_transformation",
"operation-type": "search",
"index": "{{index_name | default('custom-big5')}}",
"body": {
"query": {
"match_all": {}
},
"_source": {
"includes": ["aws.cloudwatch.log_stream", "@timestamp"],
"excludes": []
},
"sort": [
{
"@timestamp": {
"order": "desc",
"missing": "_last"
}
}
]
}
}
*/
source = custom-big5
| parse `aws.cloudwatch.log_stream` "eni-(?<eniid>[0-9]+)"
| eval eniid_num = cast(eniid as int)
| fields `aws.cloudwatch.log_stream`, eniid, eniid_num, `@timestamp`
| sort - `@timestamp`
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
{
"name": "script_engine_like_pattern_with_aggregation",
"operation-type": "search",
"index": "{{index_name | default('custom-big5')}}",
"body": {
"query": {
"script": {
"script": {
"source": "{\"langType\":\"calcite\",\"script\":\"...\"}",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is message field type?

"lang": "opensearch_compounded_script",
"params": {
"utcTimestamp": "{{current_timestamp}}"
}
},
"boost": 1.0
}
},
"_source": {
"includes": ["message", "metrics.size"],
"excludes": []
},
"aggregations": {
"composite_buckets": {
"composite": {
"size": 10000,
"sources": [
{
"metrics.size": {
"terms": {
"field": "metrics.size",
"missing_bucket": true,
"missing_order": "first",
"order": "asc"
}
}
}
]
}
}
}
}
}
*/
source = custom-big5
| where like(`message`, '%sshd%')
| stats count() by `metrics.size`
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query body should include size:10?

"name": "script_engine_like_pattern_with_sort",
"operation-type": "search",
"index": "{{index_name | default('big5')}}",
"body": {
"query": {
"script": {
"script": {
"source": "{\"langType\":\"calcite\",\"script\":\"...\"}",
"lang": "opensearch_compounded_script",
"params": {
"utcTimestamp": "{{current_timestamp}}"
}
},
"boost": 1.0
}
},
"_source": {
"includes": ["agent", "process", "log", "message", "tags", "cloud", "input", "@timestamp", "ecs", "data_stream", "meta", "host", "metrics", "aws", "event"],
"excludes": []
},
"sort": [
{
"@timestamp": {
"order": "desc",
"missing": "_last"
}
}
]
}
}
*/
source = custom-big5
| where like(`message`, '%sshd%')
| sort - `@timestamp`
| head 10
Loading