wishlist: redirect logging to syslog

105 views
Skip to first unread message

chie...@salk.edu

unread,
Jun 2, 2014, 7:32:17 PM6/2/14
to gito...@googlegroups.com
I've looked and I don't see a simple way to redirect gitolite logging from ~/.gitolite/logs to syslog.

Does anyone know how to do this simply?

Otherwise, consider this a vote for such a feature. In the meantime I can make do.

Konstantin Ryabitsev

unread,
Jun 2, 2014, 9:17:13 PM6/2/14
to chie...@salk.edu, gito...@googlegroups.com
On 02/06/14 07:32 PM, chie...@salk.edu wrote:
> I've looked and I don't see a simple way to redirect gitolite logging from ~/.gitolite/logs to syslog.

It is a feature I'd like to see as well -- not as a replacement for
~/.gitolite/logs, but as an addition.

> Does anyone know how to do this simply?

If you are using rsyslog, you can do the following. Add this to your
rsyslog.conf (fixing paths as necessary):

# Send gitolite logs to rsyslog via local5.info
$ModLoad imfile
$InputFileName /var/lib/gitolite/.gitolite/logs/gitolite.log
$InputFileTag gitolite:
$InputFileStateFile stat-gitolite-log
$InputFileSeverity info
$InputFileFacility local5
$InputRunFileMonitor

Then symlink gitolite.log to the current gitolite-YYYY-MM-DD.log, and
then create the following cronjob to make sure the symlink is updated
each month (assuming your gitolite runs as user "gitolite"):

0 0 1 * * gitolite ln -sf
/var/lib/gitolite/.gitolite/logs/gitolite-$(date +'\%Y-\%m').log
/var/lib/gitolite/.gitolite/logs/gitolite.log

Best,
Konstantin

signature.asc

Michel Bourget

unread,
Jun 2, 2014, 9:32:04 PM6/2/14
to Konstantin Ryabitsev, chie...@salk.edu, gito...@googlegroups.com
Wouldn't be simpler to just symlink /var/lib/gitolite/.gitolite/logs/gitolite-$(date +'\%Y-\%m').log
to /var/log/gitolite.log and, of course, with the cron companion setup ?

What could help a bit is for gitolite to symlink gitolite.log to the proper gitolite-YYYY-MM-DD.log
In its own directory. That would be simpler instead of having a cron entry. What's left is for root to create the symlink in /var/log ...

Maybe I am missing something ...

Michel

Sitaram Chamarty

unread,
Jun 3, 2014, 12:39:33 AM6/3/14
to Konstantin Ryabitsev, chie...@salk.edu, gito...@googlegroups.com, Christian Ruppert
I've had this patch laying around ever since the gentoo guys asked on
IRC (though they seem very shy to start a discussion on the mailing
list!) Unfortunately, if it's not on the mailing list I tend to forget.

Anyway I polished it up a bit, and added a doc patch to the gitolite-doc
repo. Please take a look at *both* and send me your comments.

idl0r: you too please...
0001-allow-logging-to-syslog-as-well.patch
0001-document-new-syslog-feature.patch
signature.asc

Sitaram Chamarty

unread,
Jun 3, 2014, 12:42:18 AM6/3/14
to Michel Bourget, Konstantin Ryabitsev, chie...@salk.edu, gito...@googlegroups.com
On 06/03/2014 07:02 AM, Michel Bourget wrote:
> Wouldn't be simpler to just symlink /var/lib/gitolite/.gitolite/logs/gitolite-$(date +'\%Y-\%m').log
> to /var/log/gitolite.log and, of course, with the cron companion setup ?
>
> What could help a bit is for gitolite to symlink gitolite.log to the proper gitolite-YYYY-MM-DD.log

If gitolite did that, it would have to run every single time gitolite
was invoked in any fashion. Not a big problem, but quite inelegant
compared to something else doing it at a specific time.

Konstantin Ryabitsev

unread,
Jun 3, 2014, 11:05:51 AM6/3/14
to Michel Bourget, chie...@salk.edu, gito...@googlegroups.com
On 02/06/14 09:32 PM, Michel Bourget wrote:
> Wouldn't be simpler to just symlink /var/lib/gitolite/.gitolite/logs/gitolite-$(date +'\%Y-\%m').log
> to /var/log/gitolite.log and, of course, with the cron companion setup ?

No, because that doesn't actually send things to syslog, it just places
the symlink into /var/log/gitolite.log. Just placing things into
/var/log doesn't actually add things to syslog, which is why you have to
do the file monitor trick.

-K


signature.asc

Michel Bourget

unread,
Jun 4, 2014, 10:53:36 PM6/4/14
to Konstantin Ryabitsev, chie...@salk.edu, gito...@googlegroups.com


> Le 2014-06-03 à 11:05, Konstantin Ryabitsev <konst...@linuxfoundation.org> a écrit :
>
>
> No, because that doesn't actually send things to syslog, it just places
> the symlink into /var/log/gitolite.log. Just placing things into
> /var/log doesn't actually add things to syslog, which is why you have to
> do the file monitor trick.
>


I knew that. I failed to explain why I commented that way :) I was just trying to ease its path location so it's in a well-known location admin folks expect it to be. No date to figure, etc.. After all, gitolite are time stamped, have a debug/info level and data. Everything. See previous comment(rant?) I just added a couple of minutes ago.

chie...@salk.edu

unread,
Jun 14, 2014, 2:57:52 AM6/14/14
to gito...@googlegroups.com, konst...@linuxfoundation.org, chie...@salk.edu, id...@gentoo.org
On Monday, June 2, 2014 9:39:33 PM UTC-7, Sitaram Chamarty wrote:
>
> Anyway I polished it up a bit, and added a doc patch to the gitolite-doc
>
> repo. Please take a look at *both* and send me your comments.

I haven't tested it, but it looks good to me. I'd be happy to test it if you could put it into the github repo - either as a branch or in master.

Thanks! Also, thanks for making gitolite, it really rocks.

chie...@salk.edu

unread,
Jun 14, 2014, 3:12:53 AM6/14/14
to gito...@googlegroups.com, konst...@linuxfoundation.org, chie...@salk.edu
On Monday, June 2, 2014 6:32:04 PM UTC-7, Michel Bourget wrote:
> Wouldn't be simpler to just symlink /var/lib/gitolite/.gitolite/logs/gitolite-$(date +'\%Y-\%m').log
>
> to /var/log/gitolite.log and, of course, with the cron companion setup ?
>
>
>
> What could help a bit is for gitolite to symlink gitolite.log to the proper gitolite-YYYY-MM-DD.log
>
> In its own directory. That would be simpler instead of having a cron entry. What's left is for root to create the symlink in /var/log ...
>
>

> > Le 2014-06-02 à 21:17, Konstantin Ryabitsev <konst..@lin...> a écrit :
> > $InputFileName /var/lib/gitolite/.gitolite/logs/gitolite.log


These are some good suggestions. You can avoid the symlink nonsense by putting this in your .gitolite.rc:

$GL_LOGT="$GL_ADMINDIR/logs/gitolite.log";

or

$GL_LOGT="/var/log/gitolite.log";


And use logrotate to do what it does best. Personally, I like this approach and direct syslogging best. Hopefully the $GL_LOGT won't be changed too often.

Sitaram Chamarty

unread,
Jun 14, 2014, 4:32:28 AM6/14/14
to chie...@salk.edu, gito...@googlegroups.com, konst...@linuxfoundation.org, id...@gentoo.org
On 06/14/2014 12:27 PM, chie...@salk.edu wrote:
> On Monday, June 2, 2014 9:39:33 PM UTC-7, Sitaram Chamarty wrote:
>>
>> Anyway I polished it up a bit, and added a doc patch to the gitolite-doc
>>
>> repo. Please take a look at *both* and send me your comments.
>
> I haven't tested it, but it looks good to me. I'd be happy to test it if you could put it into the github repo - either as a branch or in master.

ok; pushed to a branch called "temp".

Chris Hiestand

unread,
Jun 18, 2014, 7:00:06 PM6/18/14
to Sitaram Chamarty, gito...@googlegroups.com
This is in use now. It seems to be working just fine. Thanks!

Sitaram Chamarty

unread,
Jun 18, 2014, 7:01:02 PM6/18/14
to Chris Hiestand, gito...@googlegroups.com
On 06/19/2014 04:30 AM, Chris Hiestand wrote:
> This is in use now. It seems to be working just fine. Thanks!
>
perfect; thanks! I'm getting ready to push 3.6.1 this weekend...
Reply all
Reply to author
Forward
0 new messages