Last modified: 2013-06-08 15:19:49 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T50846, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 48846 - Provide a central logging service for tools
Provide a central logging service for tools
Status: RESOLVED FIXED
Product: Wikimedia Labs
Classification: Unclassified
tools (Other open bugs)
unspecified
All All
: Low enhancement
: ---
Assigned To: Marc A. Pelletier
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-26 21:07 UTC by Tim Landscheidt
Modified: 2013-06-08 15:19 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Tim Landscheidt 2013-05-26 21:07:32 UTC
It would be nice to have a central logging service where bots and other tools can log to.  This would spar them dealing with locks, etc., and could provide a nice web UI with filtering, sorting, etc.

This doesn't necessarily require enhanced privileges; a tool ("logger"?) could be created that has a daemon that publishes its host and port at ~local-logger/.where-to-connect-to.  Libraries would read that file, connect to the daemon and log stuff there.  http://tools.wmflabs.org/logger/ would have the UI with CSV export, etc.

There are probably existing implementations that could (should) be adapted; https://github.com/facebook/scribe seems to be one of them.
Comment 1 Yuvi Panda 2013-05-27 14:28:17 UTC
We don't need to even go as far as Scribe - even syslog can be used for this if necessary.
Comment 2 Yuvi Panda 2013-05-27 14:31:16 UTC
Twitter also uses Facebook's Scribe server. There is also http://www.rsyslog.com/ which can be used with syslog for aggregation. I don't think we should write our own.
Comment 3 Peter Bena 2013-05-29 09:00:26 UTC
yes this would be nice, maybe we should first discuss which solution is best and then implement it
Comment 4 Yuvi Panda 2013-05-29 09:02:50 UTC
Yup. Also seeing how current tools do logging - if they do it at all - would be helpful I think.
Comment 5 Yuvi Panda 2013-05-29 09:03:25 UTC
Also, does the production cluster use any such service?
Comment 6 Peter Bena 2013-06-05 10:55:43 UTC
yes production is using the tool written by tim starling, (udplogger)

anyway I think instead of creating a tool which listen on port which changes, we should create a logging server dedicated to this task with permanent IP and port
Comment 7 Peter Bena 2013-06-07 14:48:14 UTC
Rsyslogd doesn't seem to be enough for this, a separate service needs to be created
Comment 8 Peter Bena 2013-06-07 20:15:00 UTC
http://tools.wmflabs.org/logs/ o/
Comment 9 Yuvi Panda 2013-06-07 20:18:34 UTC
Is this running syslog or a similar service? I hope it isn't a custom C# server running there with no monitoring or logging of its own...

/me eyes petan suspiciously
Comment 10 Tim Landscheidt 2013-06-07 20:24:07 UTC
(In reply to comment #7)
> Rsyslogd doesn't seem to be enough for this, a separate service needs to be
> created

Why?  What's missing?

(In reply to comment #9)
> Is this running syslog or a similar service? I hope it isn't a custom C#
> server
> running there with no monitoring or logging of its own...

> /me eyes petan suspiciously

I hope it has libraries in C#, PHP, Perl, Python, C, Java, C++, Tcl, and whatever else people use on Tools.
Comment 11 Peter Bena 2013-06-07 21:14:55 UTC
(In reply to comment #10)
> (In reply to comment #7)
> > Rsyslogd doesn't seem to be enough for this, a separate service needs to be
> > created
> 
> Why?  What's missing?
> 

I forgot to mention that rsyslog was installed there as well, so feel free to use that if you prefer. It is missing basically everything I would use as a tool operator and it's incredibly complicated. But you can of course use it

> (In reply to comment #9)
> > Is this running syslog or a similar service? I hope it isn't a custom C#
> > server
> > running there with no monitoring or logging of its own...
> 
> > /me eyes petan suspiciously
> 
> I hope it has libraries in C#, PHP, Perl, Python, C, Java, C++, Tcl, and
> whatever else people use on Tools.

It is listening on UDP and TCP ports, I don't know what libraries you need? There is provided a very simple 1 line example in shell script which is likely easy to convert to any language I know. It is far simpler than rsyslog or scribe, but nearly same powerful. Why do you think it is running with no monitoring?
Comment 12 Tim Landscheidt 2013-06-07 23:30:33 UTC
(In reply to comment #11)
> > > Rsyslogd doesn't seem to be enough for this, a separate service needs to be
> > > created

> > Why?  What's missing?

> I forgot to mention that rsyslog was installed there as well, so feel free to
> use that if you prefer. It is missing basically everything I would use as a
> tool operator and it's incredibly complicated. But you can of course use it

What's complicated about rsyslog?  What's missing there that on the other hand a simple TCP sink has?! :-)

> > > Is this running syslog or a similar service? I hope it isn't a custom C#
> > > server
> > > running there with no monitoring or logging of its own...

> > > /me eyes petan suspiciously

> > I hope it has libraries in C#, PHP, Perl, Python, C, Java, C++, Tcl, and
> > whatever else people use on Tools.

> It is listening on UDP and TCP ports, I don't know what libraries you need?
> There is provided a very simple 1 line example in shell script which is
> likely
> easy to convert to any language I know. It is far simpler than rsyslog or
> scribe, but nearly same powerful. Why do you think it is running with no
> monitoring?

As you know, there are lots of logging frameworks where you can just plug in modules for rsyslog or other remote daemons (or files or printers or ...).  Your daemon implements a new protocol, so we need new plugins for them.

For example, how do I configure Python's logging to log to your daemon?
Comment 13 Peter Bena 2013-06-08 05:30:16 UTC
there /is/ rsyslog installed, it may not be configured to work well enough because IMHO single instance of rsyslog doesn't even support such a complex configuration that it would log the local syslog (the one in /var/log) to local fs and remote syslog from certain kind of services to network storage - I think we would need to spawn multiple rsyslog daemons for that.

If you know how to do that - do that! Bots project is a testing environment for this kind of stuff, you can have root there if you don't have it already and there is equivalent of this on bots-syslog (identical server as tools-syslog)

Once you finish configuration of rsyslog, then preferably either insert it to puppet class (syslog.pp in modules/toollabs/manifests) or just document it and I will do it.

This bug is about central logging service - which we apparently have now. I believe that wast majority of tool operators will prefer something really simple over stuff that is complicated - this daemon allows you to define things like if the logs should be written in a txt / xml / html file how they should be formatted per line, define own formatting on demand or define own sections for logfiles on demand per tool. This isn't possible in rsyslog without changing configuration files.

Rsyslog is a good tool for gathering system (server / kernel / daemon) logs for person with root on server, but it is lacking features bot operators might use.

However I have nothing against having multiple options for people, if you like rsyslog, or whatever else, why not...

Regard
Comment 14 Peter Bena 2013-06-08 05:35:24 UTC
I hit enter before I wrote it...

* Regarding your second question about python:

There is of course no python module for this, but if I knew python it would be matter of 2 minutes to make some (which is not a case of rsyslog)

Just create a python function that does some equivalent of this

public static void Log(string text, string toolname)
{
    // Change SendUDP / SendTCP to some python fuction which allows sending over UDP or TCP
    // SendUDP ( host, port, text)
    SendUDP( "tools-syslog", 64386, "s " + toolname + " 1 " + text);
}

That is all
Comment 15 Ori Livneh 2013-06-08 09:22:17 UTC
(In reply to comment #14)
> There is of course no python module for this

Bzzt! http://docs.python.org/2/library/logging.handlers.html#datagramhandler


    # -*- coding: utf-8 -*-
    from __future__ import unicode_literals

    import logging
    import logging.handlers

    class ToolLabsHandler(logging.handlers.DatagramHandler):
        def makePickle(self, record):
            return 's {0.name} 1 {0.msg}'.format(record).encode('utf-8', errors='replace')



    if __name__ == '__main__':
        # If invoked as standalone, perform self-test.
        log = logging.getLogger('my_tool_name')
        log.setLevel(logging.INFO)
        handler = ToolLabsHandler('localhost', 64386)
        log.addHandler(handler)
        log.info('Hello, world.')
Comment 16 Yuvi Panda 2013-06-08 15:19:49 UTC
I'm currently reading through the rsyslog manual, should be able to set something up soon :)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links