[SERVER-42198]  trafficRecordingDirectory="./" fails Created: 12/Jul/19  Updated: 27/Oct/23  Resolved: 06/Aug/19

Status: Closed
Project: Core Server
Component/s: Logging
Affects Version/s: 4.2.0-rc2
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Eugene Bogaart Assignee: Mira Carey
Resolution: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Sprint: Service Arch 2019-07-15, Service Arch 2019-08-12
Participants:

 Description   

If MongoDB server started with relative path name then traffic recording does not create output file.

mongod  --dbpath data --logpath data/mongod.log  --setParameter trafficRecordingDirectory="data" --fork

however if started:

mongod  --dbpath data --logpath data/mongod.log  --setParameter trafficRecordingDirectory="`pwd`/data" --fork

succeeds. 



 Comments   
Comment by Mira Carey [ 06/Aug/19 ]

Closing this is out as works as designed. relative paths always work, they're just relative to / after --fork.

Comment by Mira Carey [ 12/Jul/19 ]

This isn't a problem with relative paths for that setParameter, but instead a problem of using a relative path with --fork.

We do some validation at startup to make sure that your traffic capture directory is actually a directory, but we do it with the cwd of the process pre-fork. After the fork your cwd is / (that's a side effect of double forking to daemonize).

Separately, I'd like to emphasize that it's a bad idea to make your traffic recording directory your dbpath. startTrafficRecording can write anywhere it likes in that directory, which opens up an unpleasant security hole if you point that in the same place as required database files. (I.e. it's easy for a remote user to accidentally/maliciously overwrite data)

Generated at Thu Feb 08 04:59:51 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.