|
12 | 12 | # system that doesn't have the specified volume. |
13 | 13 | # |
14 | 14 | # It assumes: |
15 | | -# - That there is only one data vserver per FSxN file system and that it |
16 | | -# is named 'fsx'. |
17 | 15 | # - That the administrator username is 'fsxadmin'. |
18 | 16 | # - That the audit log files will be named in the following format: |
19 | | -# audit_fsx_D2024-09-24-T13-00-03_0000000000.xml |
20 | | -# Where 'fsx' is the vserver name. |
| 17 | +# audit_vserver_D2024-09-24-T13-00-03_0000000000.xml |
| 18 | +# Where 'vserver' is the vserver name. |
21 | 19 | # |
22 | 20 | ################################################################################ |
23 | 21 | # |
|
54 | 52 | # all FSxNs. |
55 | 53 | #volumeName = "audit_logs" |
56 | 54 | # |
| 55 | +# The name of the vserver that holds the audit logs. Assumed to be the same on |
| 56 | +# all FSxNs. |
| 57 | +# *NOTE*:The program has been updated to loop on all the vservers within an FSxN |
| 58 | +# filesystem and not just the one set here. This variable is now used |
| 59 | +# so it can update the lastFireRead stats file to conform to the new format |
| 60 | +# that includes the vserver as part of the structure. |
| 61 | +#vserverName = "fsx" |
| 62 | +# |
57 | 63 | # The CloudWatch log group to store the audit logs in. |
58 | 64 | #logGroupName = "/fsx/audit_logs" |
59 | 65 |
|
@@ -261,6 +267,9 @@ def checkConfig(): |
261 | 267 | config[item] = os.environ.get(item) |
262 | 268 | if config[item] == None: |
263 | 269 | raise Exception(f"{item} is not set.") |
| 270 | + # |
| 271 | + # To be backwards compatible, load the vserverName. |
| 272 | + config['vserverName'] = vserverName if 'vserverName' in globals() else os.environ.get('vserverName') # pylint: disable=E0602 |
264 | 273 |
|
265 | 274 | ################################################################################ |
266 | 275 | # This is the main function that checks that everything is configured correctly |
@@ -325,6 +334,11 @@ def lambda_handler(event, context): # pylint: disable=W0613 |
325 | 334 | for fsxn in fsxNs: |
326 | 335 | fsId = fsxn.split('.')[1] |
327 | 336 | # |
| 337 | + # Since the format of the lastReadFile sttucture has changed, we need to update it. |
| 338 | + if lastFileRead.get(fsxn) is not None and config['vserverName'] is not None: |
| 339 | + if type(lastFileRead[fsxn]) is float: # Old format |
| 340 | + lastFileRead[fsxn] = {config['vserverName']: lastFileRead[fsxn]} # New format |
| 341 | + # |
328 | 342 | # Get the password |
329 | 343 | password = secrets.get(fsId) |
330 | 344 | if password == None: |
|
0 commit comments