[SERVER-61354] Audit log creates empty file and rotates when one does not exist Created: 09/Nov/21  Updated: 29/Oct/23  Resolved: 09/Feb/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.0

Type: Bug Priority: Major - P3
Reporter: Shreyas Kalyan Assignee: Erwin Pe
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v5.0
Sprint: Security 2021-11-29, Security 2021-12-13, Security 2022-02-07, Security 2022-02-21
Participants:
Linked BF Score: 40

 Description   

The audit log behavior on startup of the mongos or mongod is as such. Assume the audit log file specified through the server parameters is audit.log. If a file called audit.log exists in the directory, the node should move the existing file to a file called audit.log_

{timestamp} where {timestamp}

is the current time. If a file does not exist on startup, the node should create the file.

However, the behavior observed in BF-22988 is that when the file does not exist, the node creates a file, rotates it to the name audit.log_

{timestamp}

, and then creates a new file audit.log and starts writing to this file. This causes unnecessary file clutter in a user's directory, so we should fix this behavior.



 Comments   
Comment by Githook User [ 09/Feb/22 ]

Author:

{'name': 'Erwin Pe', 'email': 'erwin.pe@mongodb.com', 'username': 'erwee'}

Message: SERVER-61354 stop creating the audit log file if it doesn't exist on startup before rotation
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/305d00977e549c2c96dc9307c1c87ceb37fd2f3c

Generated at Thu Feb 08 05:52:13 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.