What a coincidence. I just did setup a log file to log when my router spontaneously resets.
It’s really not hard, Here’s the flow that uses simpletime and a function node to add date and time to msg.payload. Just enter simpletime with whatever you want to log in msg.payload.
[{"id":"93edaf35.bb12b","type":"file","z":"eb64de9a.f978e","name":"","filename":"/share/logs/router.log","appendNewline":true,"createDir":false,"overwriteFile":"false","encoding":"none","x":800,"y":2420,"wires":[[]]},{"id":"238a0338.8d7edc","type":"function","z":"eb64de9a.f978e","name":"Add the date & time and topic to the payload","func":"//Add the date & time to the payload\n\nvar str = msg.mydate + ',' + msg.mytime + ',' + msg.payload;\nmsg.payload = str;\nreturn msg;\n","outputs":1,"noerr":0,"x":490,"y":2420,"wires":[["93edaf35.bb12b"]]},{"id":"81aabe64.18e9f","type":"simpletime","z":"eb64de9a.f978e","name":"","x":210,"y":2420,"wires":[["238a0338.8d7edc"]]}]
I am on an Intel NUC, so your file path will be different on the Raspberry. You can use an inject node to force the file out node to create a file, then use find to find where the OS put it. Or, just wait and someone with more experience than I will tell you the path.
If the log file is always the same name, then you could make the logging nodes into a subflow.