Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI examples for CloudWatch Logs #8995

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

ashishbharadwajm
Copy link

Issue #, if available:

Description of changes:
Add example CLI commands for Amazon CloudWatch Logs: https://docs.aws.amazon.com/cli/latest/reference/logs/

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@elysahall elysahall self-requested a review October 21, 2024 16:24
@elysahall elysahall self-assigned this Oct 21, 2024
@elysahall elysahall added documentation This is a problem with documentation. pr:work-in-progress This PR is a draft and needs further work. labels Oct 21, 2024

aws logs associate-kms-key \
--log-group-name demo-log-group \
--kms-key-id ``KMS_KEY_ID_ARN``
Copy link
Author

Choose a reason for hiding this comment

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

Security software installed on my system blocks any push that contain sensitive info like KMS Key ID (even an example one). Hence, replaced it with KMS_KEY_ID_ARN.

Copy link
Collaborator

@elysahall elysahall left a comment

Choose a reason for hiding this comment

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

Hi Ashish,
Thank you for your command example submission. I've finished reviewing your pull request. Please fix these formatting issues and push your updated commit. Thanks!


aws logs associate-kms-key \
--log-group-name demo-log-group \
--kms-key-id ``KMS_KEY_ID_ARN``
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
--kms-key-id ``KMS_KEY_ID_ARN``
--kms-key-id 1234abcd-12ab-34cd-56ef-1234567890ab

@@ -0,0 +1,9 @@
**To Associate a KMS key with the log group**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
**To Associate a KMS key with the log group**
**To associate a KMS key with the log group**

@@ -0,0 +1,9 @@
**To Associate a KMS key with the log group**

The following ``associate-kms-key`` example associates KMS key with log group named ``demo-log-group``. If the command succeeds, no output is returned. ::
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The following ``associate-kms-key`` example associates KMS key with log group named ``demo-log-group``. If the command succeeds, no output is returned. ::
The following ``associate-kms-key`` example associates KMS key with log group named ``demo-log-group``. ::

aws logs associate-kms-key \
--log-group-name demo-log-group \
--kms-key-id ``KMS_KEY_ID_ARN``

Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
This command produces no output.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Updated with the standard line after the example command as per the style guide:
https://aws.github.io/aws-cli/docs_styleguide.html#output

@@ -0,0 +1,8 @@
**To Cancel an export task**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
**To Cancel an export task**
**To cancel an export task**

@@ -0,0 +1,16 @@
**To Create or update a query definition for CloudWatch Logs Insights**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
**To Create or update a query definition for CloudWatch Logs Insights**
**To create or update a query definition for CloudWatch Logs Insights**

aws logs put-query-definition \
--name DemoLogsQueries/Example \
--log-group-names arn:aws:logs:us-east-1:123456789012:log-group:demo-log-group \
--query-string "stats sum(packets) as packetsTransferred by srcAddr, dstAddr | sort packetsTransferred desc | limit 100"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
--query-string "stats sum(packets) as packetsTransferred by srcAddr, dstAddr | sort packetsTransferred desc | limit 100"
--query-string 'stats sum(packets) as packetsTransferred by srcAddr, dstAddr | sort packetsTransferred desc | limit 100'

@@ -0,0 +1,16 @@
**To Create or update a query definition for CloudWatch Logs Insights**

The following ``put-query-definition`` example creates a query definition for CloudWatch Logs Insights. If the command succeeds, no output is returned. ::
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The following ``put-query-definition`` example creates a query definition for CloudWatch Logs Insights. If the command succeeds, no output is returned. ::
The following ``put-query-definition`` example creates a query definition for CloudWatch Logs Insights. ::

@@ -0,0 +1,40 @@
**To Create or update a resource policy**
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
**To Create or update a resource policy**
**To create or update a resource policy**

--policy-name AllowEventBridgeEventsToCWLogs \
--policy-document file://policy.json

The file ``policy.json`` is a JSON document in the current folder.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The file ``policy.json`` is a JSON document in the current folder.
Contents of ``policy.json``::

Copy link
Collaborator

@elysahall elysahall left a comment

Choose a reason for hiding this comment

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

Hi Ashish,
Thank you for your command example submission. I've finished reviewing your pull request. Please fix these formatting issues and push your updated commit. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a problem with documentation. pr:work-in-progress This PR is a draft and needs further work.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants