logrotate?

235 views
Skip to first unread message

David Hoatson

unread,
Jun 5, 2014, 3:29:37 PM6/5/14
to turn-server-project...@googlegroups.com
Anyone successfully using logrotate (rather than TURN Server's  file rollover)?

I don't want to restart the process so am using logrotate's copytruncate feature, but TURN Server continues writing where it left off after the truncate and the file size never gets reduced and we end up with a lots of NULL bytes.

I am using flume, so I need the log file name to be consistent.

Cheers.


Mathieu H.

unread,
Jun 6, 2014, 4:14:58 PM6/6/14
to turn-server-project...@googlegroups.com
I'm using syslog output coupled with logrotate. It only leave the initial "startup" log file before the server switches to syslog output.

Gustavo García

unread,
Jun 13, 2014, 7:03:49 PM6/13/14
to turn-server-project...@googlegroups.com
I think we could register a callback for SIGHUP to reopen the log file.   It is simple and I think it is done that way in other services.   

Adding this code in mainrelay.c apparently does the job.  What do you think?

void signal_callback_handler(int signum)
{
   reset_rtpprintf();
}

signal(SIGHUP, signal_callback_handler);

Oleg Moskalenko

unread,
Jun 13, 2014, 7:52:58 PM6/13/14
to Gustavo García, turn-server-project...@googlegroups.com
OK. I’ll see where and how to insert that code. I’ll put it into the next build. 

But please file an Issue in the project page, with description of the problem.

Thanks
Oleg

--
You received this message because you are subscribed to the Google Groups "TURN Server (Open-Source project)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to turn-server-project-rfc57...@googlegroups.com.
To post to this group, send email to turn-server-project...@googlegroups.com.
Visit this group at http://groups.google.com/group/turn-server-project-rfc5766-turn-server.
For more options, visit https://groups.google.com/d/optout.

Oleg Moskalenko

unread,
Jun 14, 2014, 2:06:40 AM6/14/14
to Gustavo García, turn-server-project...@googlegroups.com
I added the SIGHUP handler to the code. You can get the latest version from SVN with that change.

Oleg

Gustavo Garcia

unread,
Jun 15, 2014, 11:42:34 PM6/15/14
to Oleg Moskalenko, turn-server-project...@googlegroups.com
Thank you very much for your quick answer!

Vladimir Tsanev

unread,
Jun 23, 2014, 4:56:10 AM6/23/14
to turn-server-project...@googlegroups.com, mom0...@gmail.com
Hi Gustavo,

Could you please share a logrotate configuration you are using.

Say for example in my turnserver.config I have

log-file=/var/log/turnserver/turn.log
pidfile=/var/run/turnserver/turnserver.pid


Is this logrotate config ok?


/var/log/turnserver/*log {
    notifempty
    copytruncate
    missingok
    postrotate
        /bin/kill -HUP `cat /var/run/turnserver/turnserver.pid 2>/dev/null` 2> /dev/null || true
    endscript
}


Vlado
To unsubscribe from this group and stop receiving emails from it, send an email to turn-server-project-rfc5766-turn-server+unsubscribe@googlegroups.com.
To post to this group, send email to turn-server-project-rfc5766-turn-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages