Skip to content

Commit ebbbb23

Browse files
authored
Merge pull request #209 from NetApp/make_ingest_more_robust
Made it update the stats file for every file it processes
2 parents 0871498 + 4f84710 commit ebbbb23

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

Monitoring/ingest_nas_audit_logs_into_cloudwatch/ingest_audit_log.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,9 +326,6 @@ def lambda_handler(event, context): # pylint: disable=W0613
326326
else:
327327
lastFileRead = json.loads(response['Body'].read().decode('utf-8'))
328328
#
329-
# Only update the lastFileRead if we actually copied a new file.
330-
lastFileReadChanged = False
331-
#
332329
# Process each FSxN.
333330
for fsxn in fsxNs:
334331
fsId = fsxn.split('.')[1]
@@ -372,11 +369,7 @@ def lambda_handler(event, context): # pylint: disable=W0613
372369
# Process the file.
373370
processFile(fsxn, headersDownload, volumeUUID, filePath)
374371
lastFileRead[fsxn] = getEpoch(filePath)
375-
lastFileReadChanged = True
376-
#
377-
# Save the last read stats file.
378-
if lastFileReadChanged:
379-
s3Client.put_object(Key=config['statsName'], Bucket=config['s3BucketName'], Body=json.dumps(lastFileRead).encode('UTF-8'))
372+
s3Client.put_object(Key=config['statsName'], Bucket=config['s3BucketName'], Body=json.dumps(lastFileRead).encode('UTF-8'))
380373
#
381374
# If this script is not running as a Lambda function, then call the lambda_handler function.
382375
if os.environ.get('AWS_LAMBDA_FUNCTION_NAME') == None:

0 commit comments

Comments
 (0)