Skip to content

Commit

Permalink
CloudWatch Log Insights query snippets for EventBridge events.
Browse files Browse the repository at this point in the history
  • Loading branch information
awsrahulrsr committed Jul 12, 2023
1 parent e5918e2 commit 5825a7f
Show file tree
Hide file tree
Showing 28 changed files with 527 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "Events that match a pattern for detail-type value",
"description": "Get the EventBridge events that match a pattern for detail-type value",
"type": "CloudWatch Logs Insights",
"services": [],
"tags": [
""
],
"introBox": {
"headline": "How it works",
"text": ["Cloudwatch Log Insight snippet that gets the EventBridge events that matches a pattern for detail-type value"]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/cloudwatch-insight-eventbridge-event-by-detail-type-like"
}
},
"snippets": [
{
"snippetPath": "snippet.txt",
"language": "css"
}
],
"authors": [
{
"headline": "Presented by Rahul Sringeri",
"name": "Rahul Sringeri",
"image": "",
"bio": "Technical Account Manager at AWS for Strategic Accounts",
"linkedin": "",
"twitter": ""
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields @timestamp
| filter `detail-type` like /sample-value/ # replace sample-value with actual value to be searched
| sort @timestamp desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "Events grouped by source",
"description": "Get the number of EventBridge events by source",
"type": "CloudWatch Logs Insights",
"services": [],
"tags": [
""
],
"introBox": {
"headline": "How it works",
"text": ["Cloudwatch Log Insight snippet that counts the number of EventBridge events and groups by source"]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/cloudwatch-insight-eventbridge-event-count-by-source"
}
},
"snippets": [
{
"snippetPath": "snippet.txt",
"language": "css"
}
],
"authors": [
{
"headline": "Presented by Rahul Sringeri",
"name": "Rahul Sringeri",
"image": "",
"bio": "Technical Account Manager at AWS for Strategic Accounts",
"linkedin": "",
"twitter": ""
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields @timestamp
| stats count(*) as EventsCountBySource by source
| sort @timestamp desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"title": "Events with detail field value falling in a given numeric range ",
"description": "Get the EventBridge events for a given detail field that has values within a given numeric range",
"type": "CloudWatch Logs Insights",
"services": [],
"tags": [
""
],
"introBox": {
"headline": "How it works",
"text": ["Cloudwatch Log Insight snippet that returns the EventBridge events for a given detail field that has values within a given numeric range"]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/cloudwatch-insight-eventbridge-event-detail-field-within-a-numeric-range"
}
},
"snippets": [
{
"snippetPath": "snippet.txt",
"language": "css"
}
],
"authors": [
{
"headline": "Presented by Rahul Sringeri",
"name": "Rahul Sringeri",
"image": "",
"bio": "Technical Account Manager at AWS for Strategic Accounts",
"linkedin": "",
"twitter": ""
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields @timestamp
| filter detail.field-value >= N1 and detail.field-value <= N2 # replace field-value, N1, N2 with actual values. N1 and N2 are the numeric range.
| sort @timestamp desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "Filter Events by value of a detail field",
"description": "Get the EventBridge events by filtering on a detail field",
"type": "CloudWatch Logs Insights",
"services": [],
"tags": [
""
],
"introBox": {
"headline": "How it works",
"text": ["Cloudwatch Log Insight snippet that filters the EventBridge events by value of a detail field"]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/cloudwatch-insight-eventbridge-event-filter-by-detail-field"
}
},
"snippets": [
{
"snippetPath": "snippet.txt",
"language": "css"
}
],
"authors": [
{
"headline": "Presented by Rahul Sringeri",
"name": "Rahul Sringeri",
"image": "",
"bio": "Technical Account Manager at AWS for Strategic Accounts",
"linkedin": "",
"twitter": ""
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields @timestamp
| filter detail.field-name = "field-value" # replace field-name and field-value with actual values
| sort @timestamp desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"title": "Filter Events by detail field value not equal to a given value",
"description": "Get the EventBridge events by filtering on a detail field value that is not equal to a given value ",
"type": "CloudWatch Logs Insights",
"services": [],
"tags": [
""
],
"introBox": {
"headline": "How it works",
"text": ["Cloudwatch Log Insight snippet that filters the EventBridge events on a detail field value not equal to a given value"]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/cloudwatch-insight-eventbridge-event-filter-by-detail-field-not-equal-to"
}
},
"snippets": [
{
"snippetPath": "snippet.txt",
"language": "css"
}
],
"authors": [
{
"headline": "Presented by Rahul Sringeri",
"name": "Rahul Sringeri",
"image": "",
"bio": "Technical Account Manager at AWS for Strategic Accounts",
"linkedin": "",
"twitter": ""
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields @timestamp
| filter detail.field-name != "field-value" # replace field-name and field-value with actual values
| sort @timestamp desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "Events that match the value of detail-type",
"description": "Get the EventBridge events that match the value of detail-type",
"type": "CloudWatch Logs Insights",
"services": [],
"tags": [
""
],
"introBox": {
"headline": "How it works",
"text": ["Cloudwatch Log Insight snippet that filters the EventBridge events by value of detail-type"]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/cloudwatch-insight-eventbridge-event-filter-by-detail-type"
}
},
"snippets": [
{
"snippetPath": "snippet.txt",
"language": "css"
}
],
"authors": [
{
"headline": "Presented by Rahul Sringeri",
"name": "Rahul Sringeri",
"image": "",
"bio": "Technical Account Manager at AWS for Strategic Accounts",
"linkedin": "",
"twitter": ""
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields @timestamp
| filter `detail-type` = "detail-type-value" # replace detail-type-value with the actual value
| sort @timestamp desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "Events that match a value in detail-field that has an array of values",
"description": "Get the EventBridge events that match a value in detail-field that has an array of values",
"type": "CloudWatch Logs Insights",
"services": [],
"tags": [
""
],
"introBox": {
"headline": "How it works",
"text": ["Cloudwatch Log Insight snippet that gets the EventBridge events that matches a value in detail-field that has an array of values"]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/cloudwatch-insight-eventbridge-event-filter-detail-field-with-values-in-array"
}
},
"snippets": [
{
"snippetPath": "snippet.txt",
"language": "css"
}
],
"authors": [
{
"headline": "Presented by Rahul Sringeri",
"name": "Rahul Sringeri",
"image": "",
"bio": "Technical Account Manager at AWS for Strategic Accounts",
"linkedin": "",
"twitter": ""
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields @timestamp
| filter detail.array-field.n1 = "sample-value" # replace array-field with the field name having values as array, n1 with array position and sample-value with value to filter.
| sort @timestamp desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"title": "Get Events if a given detail field is present ",
"description": "Get the EventBridge events if detail field is present",
"type": "CloudWatch Logs Insights",
"services": [],
"tags": [
""
],
"introBox": {
"headline": "How it works",
"text": ["Cloudwatch Log Insight snippet that returns the EventBridge events if a given detail field is present"]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/cloudwatch-insight-eventbridge-event-find-if-detail-field-exists"
}
},
"snippets": [
{
"snippetPath": "snippet.txt",
"language": "css"
}
],
"authors": [
{
"headline": "Presented by Rahul Sringeri",
"name": "Rahul Sringeri",
"image": "",
"bio": "Technical Account Manager at AWS for Strategic Accounts",
"linkedin": "",
"twitter": ""
}
]
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fields @timestamp
| filter ispresent(detail.field-name) # replace field-name with the actual value
| sort @timestamp desc
34 changes: 34 additions & 0 deletions cloudwatch-insight-eventbridge-event-per-hour/sample-data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"title": "Events per hour ",
"description": "Get the EventBridge events per hour",
"type": "CloudWatch Logs Insights",
"services": [],
"tags": [
""
],
"introBox": {
"headline": "How it works",
"text": ["Cloudwatch Log Insight snippet that returns the EventBridge events per hour"]
},
"gitHub": {
"template": {
"repoURL": "https://github.com/aws-samples/serverless-snippets/tree/main/cloudwatch-insight-eventbridge-event-per-minute"
}
},
"snippets": [
{
"snippetPath": "snippet.txt",
"language": "css"
}
],
"authors": [
{
"headline": "Presented by Rahul Sringeri",
"name": "Rahul Sringeri",
"image": "",
"bio": "Technical Account Manager at AWS for Strategic Accounts",
"linkedin": "",
"twitter": ""
}
]
}
4 changes: 4 additions & 0 deletions cloudwatch-insight-eventbridge-event-per-hour/snippet.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
fields @timestamp
| filter ispresent(`detail-type`)
| stats count(*) as CountOfEventsPerHour by bin(1h)
| sort @timestamp desc
Loading

0 comments on commit 5825a7f

Please sign in to comment.