You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Monitoring/ingest_nas_audit_logs_into_cloudwatch/README.md
+20-11Lines changed: 20 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,14 @@
1
1
# Ingest FSx for ONTAP NAS audit logs into CloudWatch
2
2
3
3
## Overview
4
-
This sample will demonstrate a way to ingest the NAS audit logs from an FSx for Data ONTAP file system into a CloudWatch log group
4
+
This sample demonstrates a way to ingest the NAS audit logs from an FSx for Data ONTAP file system into a CloudWatch log group
5
5
without having to NFS or CIFS mount a volume to access them.
6
6
It will attempt to gather the audit logs from all the FSx for Data ONTAP file systems that are within a specified region.
7
7
It will skip any file systems where the credentials aren't provided in the supplied AWS SecretManager's secret, or that do not have
8
8
the appropriate NAS auditing configuration enabled.
9
9
It will maintain a "stats" file in an S3 bucket that will keep track of the last time it successfully ingested audit logs from each
10
-
file system to try and ensure it doesn't process an audit file more than once..
11
-
You can run this program as a standalone program or as a Lambda function. These directions assume you are going to run it as a Lambda function.
10
+
file system to try to ensure it doesn't process an audit file more than once.
11
+
You can run this script as a standalone program or as a Lambda function. These directions assume you are going to run it as a Lambda function.
12
12
13
13
## Prerequisites
14
14
- An FSx for Data ONTAP file system.
@@ -17,15 +17,15 @@ You can run this program as a standalone program or as a Lambda function. These
17
17
- Have the NAS auditing configured to store the audit logs in a volume with the same name on all FSx for Data ONTAP file
18
18
systems that you want to ingest the audit logs from.
19
19
- A CloudWatch log group.
20
-
- An AWS Secrets Manager secret that contains the passwords for the fsxadmin account for all the FSx for Data ONTAP file system you want to gather audit logs from.
20
+
- An AWS Secrets Manager secret that contains the passwords for the fsxadmin account for all the FSx for Data ONTAP file systems you want to gather audit logs from.
21
21
- The secret should be in the form of key/value pairs (or a JSON object) where the key is the file system ID and value is the password for the fsxadmin account. For example:
22
22
```json
23
23
{
24
24
"fs-1234567890abcdef0": "password1",
25
25
"fs-abcdef012345" : "password2"
26
26
}
27
27
```
28
-
- You have applied the necessary SACLS to the files you want to audit.
28
+
- You have applied the necessary SACLs to the files you want to audit. The knowledge base article linked above provides guidance on how to do this.
29
29
- You have created a role with the necessary permissions to allow the Lambda function to do the following:
30
30
31
31
<table>
@@ -41,6 +41,11 @@ systems that you want to ingest the audit logs from.
-<region> - is the region where the FSx for ONTAP file systems are located.
47
+
-<logGroupName> - is the name of the CloudWatch log group where the audit logs will be ingested.
48
+
-<secretName> - is the name of the secret that contains the credentials for the fsxadmin accounts.
44
49
45
50
## Deployment
46
51
1. Create a Lambda deployment package by:
@@ -51,24 +56,28 @@ systems that you want to ingest the audit logs from.
51
56
1. Zip the contents of the directory into a zip file.<br>
52
57
`zip -r ingest_fsx_audit_logs.zip .`<br>
53
58
54
-
2.Create the Lambda function with:
59
+
2.Within the AWS console, or using the AWS API, create a Lambda function with:
55
60
1. Python 3.10, or higher, as the runtime.
56
61
1. Set the permissions to the role created above.
57
62
1. Under `Additional Configurations` select `Enable VPC` and select a VPC and Subnet that will have access to all the FSx for ONtAP file system management endpoints that you want to gather audit logs from.
58
63
1. Click `Create Function` and on the next page, under the `Code` tab, select `Upload From -> .zip file.` Provide the .zip file created by the steps above.
59
64
1. From the `Configuration -> General` tab set the timeout to at least 30 seconds. You will may need to increase that if it has to process a lot of audit entries and/or process a lot of FSx for ONTAP file systems.
60
-
3. Configure the Lambda function by setting the following environment variables. For a Lambda function you do this by clicking on the `Configuration` tab and then the `Environment variables` section.
65
+
66
+
3. Configure the Lambda function by setting the following environment variables. For a Lambda function you do this by clicking on the `Configuration` tab and then the `Environment variables` sub tab.
61
67
62
68
| Variable | Description |
63
69
| --- | --- |
64
70
| secretArn | The ARN of the secret that contains the credentials for all the FSx for ONTAP file systems you want to gather audit logs from. |
65
71
| secretRegion | The region where the secret is stored. |
66
-
| s3BucketRegion | The region of the S3 bucket where stats file is stored. |
67
-
| s3BucketName | The name of the S3 bucket where the stats are stored. |
68
-
| statsName | The name of the S3 object that contains the stats file. |
72
+
| s3BucketRegion | The region of the S3 bucket where the stats file is stored. |
73
+
| s3BucketName | The name of the S3 bucket where the stats file is stored. |
74
+
| statsName | The name you want to use as the stats file. |
69
75
| logGroupName | The name of the CloudWatch log group to ingest the audit logs into. |
70
76
71
-
4. After you have tested it, add an EventBridge trigger to run periodically. You can do this by clicking on the `Add Trigger` button and selecting `EventBridge (CloudWatch Events)` from the dropdown. You can then configure the schedule to run as often as you want. How often depends on how often you have set up your FSx for ONTAP file systems to generate audit logs, and how up-to-date you want the CloudWatch logs to be.
77
+
4. After you have tested that the Ladmba function is running correctly, add an EventBridge trigger to have it run periodically.
78
+
You can do this by clicking on the `Add Trigger` button within the AWS console and selecting `EventBridge (CloudWatch Events)`
79
+
from the dropdown. You can then configure the schedule to run as often as you want. How often depends on how often you have
80
+
set up your FSx for ONTAP file systems to generate audit logs, and how up-to-date you want the CloudWatch logs to be.
0 commit comments