diff --git a/awscli/examples/logs/delete-index-policy.rst b/awscli/examples/logs/delete-index-policy.rst new file mode 100644 index 000000000000..08499ed23364 --- /dev/null +++ b/awscli/examples/logs/delete-index-policy.rst @@ -0,0 +1,10 @@ +**To delete a log-group level field index policy** + +The following ``delete-index-policy`` example deletes a log-group level field index policy that was applied to a single log group. :: + + aws logs delete-index-policy \ + --log-group-identifier arn:aws:logs:us-east-1:123456789012:log-group:CWLG + +This command produces no output. + +For more information, see `Amazon CloudWatch Logs `__ in the *Amazon CloudWatch User Guide*. \ No newline at end of file diff --git a/awscli/examples/logs/delete-transformer.rst b/awscli/examples/logs/delete-transformer.rst new file mode 100644 index 000000000000..06d98236b95b --- /dev/null +++ b/awscli/examples/logs/delete-transformer.rst @@ -0,0 +1,10 @@ +**To delete the log transformer** + +The following ``delete-transformer`` example deletes the log transformer for the specified log group. :: + + aws logs delete-transformer \ + --log-group-identifier arn:aws:logs:us-east-1:123456789012:log-group:CWLG + +This command produces no output. + +For more information, see `Amazon CloudWatch Logs `__ in the *Amazon CloudWatch User Guide*. \ No newline at end of file diff --git a/awscli/examples/logs/describe-field-indexes.rst b/awscli/examples/logs/describe-field-indexes.rst new file mode 100644 index 000000000000..251aa2817da0 --- /dev/null +++ b/awscli/examples/logs/describe-field-indexes.rst @@ -0,0 +1,21 @@ +**To return a list of field indexes** + +The following ``describe-field-indexes`` example returns a list of field indexes listed in the field index policies of one or more log groups. :: + + aws logs describe-field-indexes \ + --log-group-identifiers arn:aws:logs:us-east-1:123456789012:log-group:CWLG + +Output:: + +{ + "fieldIndexes": [ + { + "logGroupIdentifier": "arn:aws:logs:us-east-1:123456789012:log-group:CWLG", + "fieldIndexName": "@logStream", + "firstEventTime": 1738039122783, + "lastEventTime": 1738039239900 + } + ] +} + +For more information, see `Amazon CloudWatch Logs `__ in the *Amazon CloudWatch User Guide*. \ No newline at end of file diff --git a/awscli/examples/logs/describe-index-policies.rst b/awscli/examples/logs/describe-index-policies.rst new file mode 100644 index 000000000000..aa00f1a8fcf4 --- /dev/null +++ b/awscli/examples/logs/describe-index-policies.rst @@ -0,0 +1,21 @@ +**To return returns the field index policies** + +The following ``describe-index-policies`` example returns the field index policies of one or more log groups. :: + + aws logs describe-index-policies \ + --log-group-identifiers arn:aws:logs:us-east-1:123456789012:log-group:CWLG + +Output:: + +{ + "indexPolicies": [ + { + "logGroupIdentifier": "arn:aws:logs:us-east-1:123456789012:log-group:CWLG", + "lastUpdateTime": 1738040112829, + "policyDocument": "{\"Fields\":[\"@ingestionTime\",\"@requestId\"]}", + "source": "LOG_GROUP" + } + ] +} + +For more information, see `Amazon CloudWatch Logs `__ in the *Amazon CloudWatch User Guide*. \ No newline at end of file diff --git a/awscli/examples/logs/get-transformer.rst b/awscli/examples/logs/get-transformer.rst new file mode 100644 index 000000000000..3bb841fcc52b --- /dev/null +++ b/awscli/examples/logs/get-transformer.rst @@ -0,0 +1,44 @@ +**To return the information about the log transformer** + +The following ``get-transformer`` example returns the information about the log transformer associated with this log group. :: + + aws logs get-transformer \ + --log-group-identifier arn:aws:logs:us-east-1:123456789012:log-group:CWLG + +Output:: + +{ + "logGroupIdentifier": "CWLG", + "creationTime": 1734944243820, + "lastModifiedTime": 1738037681546, + "transformerConfig": [ + { + "parseJSON": {} + }, + { + "addKeys": { + "entries": [ + { + "key": "metadata.transformed_in", + "value": "CloudWatchLogs", + "overwriteIfExists": false + }, + { + "key": "feature", + "value": "Transformation", + "overwriteIfExists": false + } + ] + } + }, + { + "trimString": { + "withKeys": [ + "status" + ] + } + } + ] +} + +For more information, see `Amazon CloudWatch Logs `__ in the *Amazon CloudWatch User Guide*. \ No newline at end of file diff --git a/awscli/examples/logs/put-index-policy.rst b/awscli/examples/logs/put-index-policy.rst new file mode 100644 index 000000000000..3c6c68501d00 --- /dev/null +++ b/awscli/examples/logs/put-index-policy.rst @@ -0,0 +1,20 @@ +**To create or update a field index policy** + +The following ``put-index-policy`` example creates or updates a field index policy for the specified log group. :: + + aws logs put-index-policy \ + --log-group-identifier arn:aws:logs:us-east-1:123456789012:log-group:CWLG \ + --policy-document "{\"Fields\":[\"@ingestionTime\",\"@requestId\"]}" + +Output:: + +{ + "indexPolicy": { + "logGroupIdentifier": "arn:aws:logs:us-east-1:123456789012:log-group:CWLG", + "lastUpdateTime": 1738040112829, + "policyDocument": "{\"Fields\":[\"@ingestionTime\",\"@requestId\"]}", + "source": "LOG_GROUP" + } +} + +For more information, see `Amazon CloudWatch Logs `__ in the *Amazon CloudWatch User Guide*. \ No newline at end of file diff --git a/awscli/examples/logs/put-transformer.rst b/awscli/examples/logs/put-transformer.rst new file mode 100644 index 000000000000..783d057b2717 --- /dev/null +++ b/awscli/examples/logs/put-transformer.rst @@ -0,0 +1,11 @@ +**To create or update a log transformer** + +The following ``put-transformer`` example creates or updates a log transformer for a single log group. :: + + aws logs put-transformer \ + --transformer-config '[{"parseJSON":{}},{"addKeys":{"entries":[{"key":"metadata.transformed_in","value":"CloudWatchLogs"},{"key":"feature","value":"Transformation"}]}},{"trimString":{"withKeys":["status"]}}]' \ + --log-group-identifier arn:aws:logs:us-east-1:123456789012:log-group:CWLG + +This command produces no output. + +For more information, see `Amazon CloudWatch Logs `__ in the *Amazon CloudWatch User Guide*. \ No newline at end of file diff --git a/awscli/examples/logs/test-transformer.rst b/awscli/examples/logs/test-transformer.rst new file mode 100644 index 000000000000..ab5dd6dce850 --- /dev/null +++ b/awscli/examples/logs/test-transformer.rst @@ -0,0 +1,21 @@ +**To test a log transformer** + +The following ``test-transformer`` example is used to test a log transformer. :: + + aws logs test-transformer \ + --transformer-config "[{\"grok\":{\"source\":\"@message\",\"match\":\"%{NUMBER:version} %{HOSTNAME:hostname} %{NOTSPACE:status} %{QUOTEDSTRING:logMsg}\"}},{\"addKeys\":{\"entries\":[{\"key\":\"environment\",\"value\":\"Prd-Application-01\",\"overwriteIfExists\":false}]}}]" + --log-event-messages "293750 server-01.internal-network.local OK \"[Thread-000] token generated\"" + +Output:: + +{ + "transformedLogs": [ + { + "eventNumber": 1, + "eventMessage": "293750 server-01.internal-network.local OK \"[Thread-000] token generated\"", + "transformedEventMessage": "{\"version\":\"293750\",\"hostname\":\"server-01.internal-network.local\",\"status\":\"OK\",\"logMsg\":\"[Thread-000] token generated\",\"environment\":\"Prd-Application-01\"}" + } + ] +} + +For more information, see `Amazon CloudWatch Logs `__ in the *Amazon CloudWatch User Guide*. \ No newline at end of file