I would like to log the CDR to a file (csv or other) every few minutes. Is this possible?
Or maybe could I just send the /var/log/asterisk/cdr-csv/master.csv? How can I be sure that I am not sending it while it is being written by asterisk?
Hello @ambiorixg12 thanks for your fast anwer. If I decide to send the master.csv would be a problem if i send the file while asterisk is writing into it?
If the file is not locked, and you can read it, this won’t be a problem and you are running the script every one minute, so probably you will be overriding the content
FreePBX, which isn’t covered here, doesn’t use text files; it write CDRs to a database.
To avoid a half written record, rename the file and pause, before actually copying it. Some logs also require that you signal the process, to cause it to close an re-open the file, but I don’t think this is true for CDRs; I think the file is opened for every batch written.