Menu

Clearing PTP log?

Help
data78
2012-03-20
2012-11-23
  • data78

    data78 - 2012-03-20

    Hi,

    I've been running ptpd with "-f Log.txt" option for logging purposes. Since I've got a limited disc space I would like to clear the log once in a while. So, I came up with two solutions: to simply remove the file or to clear it's contents.

    If I do a simple "rm Log.txt", the log is deleted but ptpd doesn't create a new one. On the other hand, if I clear the contents (with a simple "echo "" > Log.txt" or smth like that), the log contents are discarded and file size is set to "0". However, next time when ptpd writes something in the log, file size is increased at the same value like it was before I cleared it.

    I presume ptpd has an opened filehandle or lock on the log file, so my question is - is there a way to clear the log (and reduce it's size) without shutting down ptpd? I can always do a simple "kill ptpd -> remove Log -> start ptpd" procedure, but I'd like to avoid it (if it is possible ofc).

    Tnx in advance ..

     
  • Matt Garman

    Matt Garman - 2012-05-30

    Have you happened to come up with an elegant solution for this?

    I too am looking at the same problem.

    I tried to use the "-V NUMBER" parameter, to at least slow down the growth of the log file.  However, it doesn't appear to work (or I don't understand exactly what it's supposed to do).

     
  • Wojciech Owczarek

    Why don't just use logrotate? Logrotate can keep your log down to a certain maximum, rotate and compress the old logs (or not if you choose not to).

     
  • Wojciech Owczarek

    Even if it's an embedded system, it should be possible to enable logrotate somehow. Even a shell script and cron could do the job in fact.

     

Log in to post a comment.