javascriptnode.jsjsonloggingwinston

How to stop audit.json file occurring in node js-winston library


I have a node.js app. And I am logging everything using winston library. My logs are daily saved on my desktop in a file. When my logs are created, there is also an audit.json file that is created automatically with my logs. And this audit.json file is saved in my logs file as well. For every run, an audit.json file is created. I want to stop occurring this audit.json file. How can I do that? Any suggestion? When I click audit.json there is some parameters that are shown such as:

(I don't have internet on my work pc so I have to write on my phone sorry)

"keep" :
        "days" : false,
         "amount" :5
              }, 
"auditLog:" C:/Users/Desktop/LogFiles/.11cjeoepdwgeudp

"files":[

"date" :"1571727049689",
"name": "path"
"hash" :"054239856656...."

Solution

  • audit.json is an important file used by Winston to create a map of your log files. Without it, you won't be able to use the daily-rotate feature. In order to get rid of it and still use the mentioned submodule, you'd have to modify the code of file-stream-rotator - a module used by Winston. It's responsible for creating this file. You could, for example, implement a database store that would replace the json file.

    The file is actually hidden on Linux systems and many users don't even know about it. Since you're using Windows, you could modify file-stream-rotator and add the hidden attribute every time the file is created. It would be much easier to achieve than moving the file map store to a database. This module would be helpful if you decided to solve the problem in this way.