How-To: Export EZSSH Logs to CloudWatch
Prerequisites for Exporting EZSSH Logs to CloudWatch
- You have registered the Keytos application in your Entra ID tenant.
- You have selected an EZSSH plan.
How To Export Your EZSSH Audit Logs To CloudWatch
To export your EZSSH logs to CloudWatch, you enable audit log export in your EZSSH subscription, get your CloudWatch connection details, and then add them to EZSSH. The following steps walk you through each part.
How To Enable Log Export in EZSSH Portal
-
Go to the EZSSH portal.
-
From the left-hand menu, click Settings.
-
Expand your subscription’s Advanced Settings.
-
Under SIEM Settings, select Send Audit Logs to SIEM.
How To Configure the CloudWatch Exporter in the CloudWatch Portal
-
Open your CloudWatch Portal in a new browser tab.
-
In the top right corner, locate your AWS Region and make a note of it.
-
From the left-hand menu, under Setup, click on Settings.
-
Go to the Logs tab. In the API Keys section, click Create.
-
Choose your preferred API key expiration, then click Generate.
-
After the key is generated, copy and save it immediately. You will not be able to view it again after leaving this page.
-
Navigate to Log Management under Logs in the left-hand menu. Select the Log Group where you want to deliver your logs.
-
Click the Actions dropdown, then select Edit bearer token authentication.
-
When prompted, enable bearer token authentication by selecting Yes.
-
Confirm that bearer token authentication is enabled.
-
Identify and note the log stream where you want your logs delivered.
How To Configure the CloudWatch SIEM in EZSSH Portal
-
Go back to the EZSSH portal.
-
Under SIEM Provider, select CloudWatch.
-
Enter the AWS Region, Log Group, Log Stream, and Bearer Token that you copied from the CloudWatch portal.
-
Click Test Connection. This creates a test log in CloudWatch. Please allow a few minutes for the log to show up in the CloudWatch portal.
Once you are done, save your settings:
-
Click Save Changes at the top of the Subscription Settings section. Your changes are not applied until you save them.
Done! EZSSH now sends your audit logs to CloudWatch. If an error occurs, EZSSH emails your Subscription Administrators.
How To Create Alerts in CloudWatch to Monitor Your SSH Activity
We recommend setting up alerts for abnormal behavior. To set up alerts in CloudWatch, go to Actions > Create metric filter within your log group. Here are some example queries to get you started:
Detect if a User Is Reusing SSH Keys
To detect any user that has reused an SSH key, set an alert if there are repeat instances of the UserPublicKey field:
fields event.UserPublicKey
| filter source = "EZSSH"
| stats count() as usageCount by event.UserPublicKey
| filter usageCount > 1
Get All SSH Requests that Granted an SSH Certificate
To get all the requests that created an SSH certificate, run the following query:
{ $.source = "EZSSH" && $.sourcetype = "EZSSH_SSH" && $.event.ActionPerformed != "Test Connection" && $.event.Certificate != "NA" }
You can correlate the results of this query with the SSH logins on your servers to verify that all logins are done with an EZSSH certificate.
Get the Count of Git Certificates Requested by User
To get the number of GitHub certificates each user has requested, run the following query:
fields event.RequestorFriendlyName
| filter source = "EZSSH" and sourcetype = "EZSSH_GIT"
| stats count() as certRequests by event.RequestorFriendlyName
| sort certRequests desc
This query is useful to find anomalies, such as a user requesting a higher number of certificates than usual.