Giter Club home page Giter Club logo

logster's Introduction

Logster - generate metrics from logfiles Build Status

Logster is a utility for reading log files and generating metrics to configurable outputs. It is ideal for visualizing trends of events that are occurring in your application/system/error logs. For example, you might use logster to graph the number of occurrences of HTTP response code that appears in your web server logs.

Logster maintains a cursor, via a tailer, on each log file that it reads so that each successive execution only inspects new log entries. In other words, a 1 minute crontab entry for logster would allow you to generate near real-time trends in the configured output for anything you want to measure from your logs.

This tool is made up of a framework script, logster, and parsing classes that are written to accommodate your specific log format. Sample parsers are included in this distribution. The parser classes essentially read a log file line by line, apply a regular expression to extract useful data from the lines you are interested in, and then aggregate that data into metrics that will be submitted to the configured output. The sample parsers should give you some idea of how to get started writing your own. A list of available parsers can be found on the Parsers page.

Graphite, Ganglia, Amazon CloudWatch, Nagios, StatsD and stdout outputs are provided, and Logster also supports the use of third-party output classes. A list of available output classes can be found on the Outputs page.

History

The logster project was created at Etsy as a fork of ganglia-logtailer (https://bitbucket.org/maplebed/ganglia-logtailer). We made the decision to fork ganglia-logtailer because we were removing daemon-mode from the original framework. We only make use of cron-mode, and supporting both cron- and daemon-modes makes for more work when creating parsing scripts. We care strongly about simplicity in writing parsing scripts -- which enables more of our engineers to write log parsers quickly.

Installation

Logster supports two methods for gathering data from a logfile:

  1. By default, Logster uses the "logtail" utility that can be obtained from the logcheck package, either from a Debian package manager or from source:

    http://packages.debian.org/source/sid/logcheck
    

    RPMs for logcheck can be found here:

    http://rpmfind.net/linux/rpm2html/search.php?query=logcheck
    
  2. Optionally, Logster can use the "Pygtail" Python module instead of logtail. You can install Pygtail using pip

    $ pip install pygtail
    

    To use Pygtail, supply the --tailer=pygtail option on the Logster commandline.

Also, Logster supports two methods for locking files (which it has to do):

  1. By default, Logster uses fcntl.flock.

  2. Optionally, Logster can use the "Portalocker" Python module instead of fcntl (which is not available on Windows). You can install Portalocker using pip, similar to Pygtail above.

    To use Portalocker, supply the --locker=portalocker option on the Logster commandline.

Once you have logtail or Pygtail installed, install Logster using the setup.py file:

$ sudo python setup.py install

Usage

You can test logster from the command line. The --dry-run option will allow you to see the metrics being generated on stdout rather than sending them to your configured output.

$ sudo /usr/bin/logster --dry-run --output=ganglia SampleLogster /var/log/httpd/access_log

$ sudo /usr/bin/logster --dry-run --output=graphite --graphite-host=graphite.example.com:2003 SampleLogster /var/log/httpd/access_log

You can use the provided parsers, or you can use your own parsers by passing the complete module and parser name. In this case, the name of the parser does not have to match the name of the module (you can have a logster.py file with a MyCustomParser parser). Just make sure the module is in your Python path - via a virtualenv, for example.

$ /env/my_org/bin/logster --dry-run --output=stdout my_org_package.logster.MyCustomParser /var/log/my_custom_log

Additional usage details can be found with the -h option:

$ logster -h
Usage: logster [options] parser logfile

Tail a log file and filter each line to generate metrics that can be sent to
common monitoring packages.

Options:
  -h, --help            show this help message and exit
  -t TAILER, --tailer=TAILER
                        Specify which tailer to use. Options are logtail and
                        pygtail. Default is "logtail".
  --logtail=LOGTAIL     Specify location of logtail. Default
                        "/usr/sbin/logtail2"
  -p METRIC_PREFIX, --metric-prefix=METRIC_PREFIX
                        Add prefix to all published metrics. This is for
                        people that may multiple instances of same service on
                        same host.
  -x METRIC_SUFFIX, --metric-suffix=METRIC_SUFFIX
                        Add suffix to all published metrics. This is for
                        people that may add suffix at the end of their
                        metrics.
  --parser-help         Print usage and options for the selected parser
  --parser-options=PARSER_OPTIONS
                        Options to pass to the logster parser such as "-o
                        VALUE --option2 VALUE". These are parser-specific and
                        passed directly to the parser.
  -s STATE_DIR, --state-dir=STATE_DIR
                        Where to store the tailer state file.  Default
                        location /var/run
  -l LOG_DIR, --log-dir=LOG_DIR
                        Where to store the logster logfile.  Default location
                        /var/log/logster
  --log-conf=LOG_CONF   Logging configuration file. None by default
  -o OUTPUT, --output=OUTPUT
                        Where to send metrics (can specify multiple times).
                        Choices are statsd, stdout, cloudwatch, graphite,
                        ganglia, nsca or a fully qualified Python class name
  -d, --dry-run         Parse the log file but send stats to standard output.
  -D, --debug           Provide more verbose logging for debugging.

Contributing

  • Fork the project
  • Add your feature
  • If you are adding new functionality, document it in the README
  • Verify your code by running the test suite, and adding additional tests if able.
  • Push the branch up to GitHub (bonus points for topic branches)
  • Send a pull request to the etsy/logster project.

If you have questions, you can find us on IRC in the #codeascraft channel on Freenode.

logster's People

Contributors

agentjeremywelkley avatar benburry avatar chino avatar darxriggs avatar elasticdog avatar elukey avatar ethan-eb avatar gilgamezh avatar grahamlyons avatar gregdurham avatar janfabry avatar jbeardsley avatar jblaine avatar jorgelzpz avatar kamaradclimber avatar katzj avatar khuongdp avatar mbabineau avatar mikebrittain avatar mmercedes avatar mrmanc avatar mrtazz avatar msabramo avatar peterscott avatar rafael81 avatar roidelapluie avatar sacreman avatar sideshowdave7 avatar stoneisle avatar tvollmer-at-is24 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

logster's Issues

parse_line does not get called

Hello,

I'm issuing logster with the following command

logster --dry-run --debug --output=stdout --log-dir=log --state-dir=run myparser.CustomParser log.txt

The content of myparser.py is

from logster.logster_helper import MetricObject, LogsterParser
from logster.logster_helper import LogsterParsingException

import re
import logging

class CustomParser(LogsterParser):

    def __init__(self, option_string=None):
        self.lines = [MetricObject('ip', '0.0.0.0')]
        self.reg = re.compile('(?P<ipaddress>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}) - - \[(?P<dateandtime>\d{2}\/[a-z]{3}\/\d{4}:\d{2}:\d{2}:\d{2} (\+|\-)\d{4})\] ((\"(GET|POST) )(?P<url>.+)(http\/1\.1")) (?P<statuscode>\d{3}) (?P<bytessent>\d+) (["](?P<refferer>(\-)|(.+))["]) (["](?P<useragent>.+)["])')

    def parse_line(self, line):
        self.lines.push(MetricObject('ip', '127.0.0.1'))
        try:
            regMatch = self.reg.match(line)

            if regMatch:
                logging.debug(regMatch.groupdict())

            else:
                raise LogsterParsingException("regmatch failed to match")

        except Exception as e:
            raise LogsterParsingException("regmatch or contents failed with %s" % e)

    def get_state(self, duration):
        return self.lines

However for some reason, parse_line does not get called.

$ wc -l log.txt
10 log.txt

$ logster --dry-run --debug --output=stdout --log-dir=log --state-dir=run myparser.CustomParser log.txt
1430448601 ip 0.0.0.0

I hope someone can help.

Thank you.

incorrect behavior in pull request #43 -- cannot specify packages

(logster)travis@travis-mint ~/new_hk/scaleHarness/agent $ logster -d --state-dir=.logster.state --output=graphite --graphite-host=dc1-graphite01:2003 --metric-prefix=hk.travis-mint --parser-options=logs/agent-0.log x.GrinderLogster logs/agent-0-data.log
Traceback (most recent call last):
File "/home/travis/venv/logster/bin/logster", line 5, in
pkg_resources.run_script('logster==0.0.1', 'logster')
File "/home/travis/venv/logster/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 499, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/home/travis/venv/logster/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 1235, in run_script
execfile(script_filename, namespace, namespace)
File "/home/travis/venv/logster/lib/python2.7/site-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 381, in
main()
File "/home/travis/venv/logster/lib/python2.7/site-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 297, in main
parser = getattr(module, parser_name)(option_string=options.parser_options)
TypeError: 'module' object is not callable

I can import x.GrinderLogster

(logster)travis@travis-mint ~/new_hk/scaleHarness/agent $ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import x.GrinderLogster

Solaris 10 doesn't like your fcntl.flock unlock

In logster itself, end_locking(), the fcntl.LOCK_NB is unwelcome in the following call on Solaris:

fcntl.flock(lockfile_fd, fcntl.LOCK_UN | fcntl.LOCK_NB)

Using the following lets the code run at least:

fcntl.flock(lockfile_fd, fcntl.LOCK_UN)

The flock call in start_locking() works fine with LOCK_NB, of course:

fcntl.flock(f, fcntl.LOCK_EX | fcntl.LOCK_NB)

How would you like me to handle a patch for this?

  1. Is there really a need to specify LOCK_NB as an option with LOCK_UN? I've never really seen anyone do that before and can't see that it would be needed.
  2. Assuming it is needed, would you like me to import platform and query platform.system() to case the flock call if the result is 'SunOS' ?

Question: Do I have to invoke logster every minute?

Apologies if this is not the right forum.

Inspired by the Etsy talk at Velocity, I'm analysing a few Apache files with logster and the total run (admittedly on a VM on my desktop) takes around 3 minutes sometimes, depending on how smoothly our servers flush their log volume. As a result I was getting warnings when running logster every minute. I've switched to every 5, but now I end up with gaps in my data in Graphite. I've included my invocation of logster below (I've renamed SampleLogster to ApacheLogster). Am I missing something?

/usr/sbin/logster --output=graphite --graphite-host=graphite:2003 -p apache.dc1.liveapp125 ApacheLogster /home/vmplanet/dws/dc1/liveapp125/apache/access.log

Thanks in advance, Mark

Support for non-realtime log analysis?

I was not able to locate any kind of logster mailing list, so I'm entering this as a ticket. Apologies if this is the wrong place for this question.

I'm not a python expert, but looking at the logster code, it seems like the first time logster reads through a large log file, all the data in the log will be sent as a single data point to graphite. Successive log file reads (presumably via cron) will then continue to generate new graphite data points more or less in realtime. Is that correct? What I want to do is read in older log files that might be days (or more) old, without having them collapse down into a single data point.

What is the take on this? Am I'm correct that this is not currently supported? If so, is there interest in accepting an implementation of this feature as a patch?

Thanks!

-Travis

Typo - SyntaxError: invalid syntax

Looks like there is a typo in a recent commit which leads to the following syntax error:

    $ logster --dry-run --output=graphite --graphite-host=localhost:2003 -p test SampleLogster /opt/log/something.txt
    Traceback (most recent call last):
      File "/usr/local/bin/logster", line 4, in <module>
        __import__('pkg_resources').run_script('logster==0.0.1', 'logster')
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 735, in run_script
        self.require(requires)[0].run_script(script_name, ns)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1651, in run_script
        code = compile(source, script_filename, 'exec')
      File "/usr/local/lib/python2.7/dist-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 170
        if (options.log_conf)
                        ^
    SyntaxError: invalid syntax

Log parsers not working

I have recently tested most of the log parsers and none of them seem to work. The output just returns 0. If any one is actively working on this project do let me know.

Tailing Logstash?

I've got a Logging setup going that pumps data to Logstash -> Elasticsearch -> Kibana.

Instead of having to connect Logster to the raw log sources, it would imho make sense/be great (?) to be able to tail Logstash instead.

Has someone attempted this, or am I completely missing the point?

Getting error while running logster

File "/usr/sbin/logster", line 58, in
from logster.logster_helper import LogsterParsingException, LockingError
ImportError: No module named logster.logster_helper

Please help

Thanks
Ankit Agarwal

Issue with parser error on latest version

Hi,

I am trying to test out the latest version of logster currently. I have copied the bin file and and running the same command instead on the file which is called logsternew.

It keeps bringing back the below error that its unable to find the parser modules but they do exist as when running it with the old file it runs ok.

Is there anywhere the specify the location of the parsers?

Details:
File "/usr/local/graphite/sources/logster/logsternew", line 358, in main
module = import(module_name, globals(), locals(), [parser_name])
ImportError: No module named logster.parsers.LsofcountLogster

DNS queries for the statsd host repeated for each socket.sendto call

Hi everybody!

The Wikimedia foundation is a happy user of logster, we use it to push Varnishkafka json logs to graphite and visualize useful metrics. While reviewing our traffic via tcpdump for an unrelated issue with noticed a ton of traffic towards our DNS resolvers for the statsd host passed to logster. From what I can see in https://github.com/etsy/logster/blob/master/logster/outputs/statsd.py#L23-L36 it seems that if you don't pass a raw ip to --statsd-host then the udp_sock.sendto call will trigger a DNS query to solve the domain.

We are using the 0.0.1 version but the issue seems still present in master. Would it be possible to add an command line option to cache the resolution of the IP address for X seconds?

Luca

Maintenance

Hi!

I just wanted to note somewhere that I am maintaining a fork of logster for the Wikimedia Foundation over at https://github.com/wikimedia/operations-debs-logster. I've made a few changes and fixes as you can see here: https://github.com/wikimedia/operations-debs-logster/commits/master. One of the reasons I haven't submitted pull requests, is this: https://github.com/wikimedia/operations-debs-logster/commit/8023713369dadf206459ef74dbad18b60181de32. It was a slight restructuring to allow use of the core logster stuff as a module, rather than having the core in the executable script. I wasn't sure how this would be received.

If Etsy would like me to submit our changes as one big pull request for consideration, I'd be happy to do so, just let me know :)

No output from logster

Trying to write a new FooLogster class, I got no output at all when testing the simplest log files.

Then, I realized these messages in the log:

WARNING  /usr/sbin/logtail2 -f foo.log -o run/logtail-logster.parsers.[...].foo.state returned bad exit code None

In https://github.com/etsy/logster/blob/master/bin/logster#L388 the check of retval is wrong; according to the python docs, the return code of popen().close() is None if the command exited with status code zero.

Edit: I must admit that my analysis of the problem was incomplete. I realized that logster makes no output at all on the first run. So this warning is just spurious.

file locking on Windows

Unfortunately, logster doesn't work on Windows due to the dependency on fcntl. You do intend to support Windows, don't you? (Judging by what I've read about the use of pygtail.)

Would it be OK to use portalocker instead of fcntl? Or use it optionally, e.g. logster --tailer pygtail --locker portalocker?

More elaborate error messages for locking issues

The error message "WARNING Failed to get lock. Is another instance of logster running?" is rather vague.

It would be helpful if the lock file that could not be acquired is outputted so it is easier to manually delete the lock file if necessary/

MetricLogster parser does not sum counts

When using MetricLogster parser, results for counts are different than I'd expect. Here's a simple example:

$ rm ~/logs/sample.log
$ echo " METRIC_COUNT metric=some.metric.count value=4 " >> ~/logs/sample.log
$ echo " METRIC_COUNT metric=some.metric.count value=4 " >> ~/logs/sample.log

$ ~/.virtualenvs/logster/bin/logster --log-dir=/home/asdf/logster --debug --state-dir=/home/asdf/logster --output=stdout MetricLogster /home/asdf/logs/sample.log
1427841578 some.metric.count 0.421052631579 # expect value to be 8

$ rm ~/logs/sample.log
$ echo " METRIC_COUNT metric=some.metric.count value=4 " >> ~/logs/sample.log
$ echo " METRIC_COUNT metric=some.metric.count value=6 " >> ~/logs/sample.log
$ echo " METRIC_COUNT metric=some.metric.count value=6 " >> ~/logs/sample.log

$ ~/.virtualenvs/logster/bin/logster --log-dir=/home/asdf/logster --debug --state-dir=/home/asdf/logster --output=stdout MetricLogster /home/asdf/logs/sample.log
1427841596 some.metric.count 0.75 # expect value to be 16

Is something going wrong with the call to get_state in MetricLogster? I don't totally understand that logic yet. Thanks!

feature request: no logtail dependency

With logtail not being available everywhere and often a perl implementation, I suggest implementing an embedded python solution which should also simplify process handling etc. Below is a snippet what could be a useful starting point.

with open(filename) as log_fd:
    offset_filename = os.path.join(OFFSET_ROOT_DIR,filename)
    if not os.path.exists(offset_filename):
        os.makedirs(os.path.dirname(offset_filename))
        with open(offset_filename, 'w') as offset_fd:
            offset_fd.write(str(0))
    with open(offset_filename, 'r+') as offset_fd:
        log_fd.seek(int(offset_fd.readline()) or 0)
        new_logrows_handler(log_fd.readlines())
        offset_fd.seek(0)
        offset_fd.write(str(log_fd.tell()))

Multiple output types causes problems with prefix

I noticed that passing multiple --output arguments is supported, however, there seems to be a bug when used with a prefix. In my test, I attempted to send to stdout, statsd, and graphite. Below is the shell output & logster.log data for one test without a prefix, and one with.

I'm not strong on python, but I would guess that the bug is somehow related to the multiple calls to submit_XXX(metrics, ...) actually modifying the contents of the metrics data when adding the prefix.

Thank you for looking into this.

[cosmo:/tmp]$ logster --output=stdout --output=statsd --output=graphite --graphite-host=127.0.0.1:2003 --statsd-host=127.0.0.1:8125 --state-dir=/tmp/logster --debug SampleLogster /tmp/access.log
1377652162 http_1xx 0.0
1377652162 http_2xx 0.0
1377652162 http_3xx 0.0
1377652162 http_4xx 0.0
1377652162 http_5xx 0.0
[cosmo:/tmp]$ logster --output=stdout --output=statsd --output=graphite --graphite-host=127.0.0.1:2003 --statsd-host=127.0.0.1:8125 --state-dir=/tmp/logster -p BUG --debug SampleLogster /tmp/access.log
1377652194 BUG_BUG.http_1xx 0.0
1377652194 BUG_BUG.http_2xx 0.0
1377652194 BUG_BUG.http_3xx 0.0
1377652194 BUG_BUG.http_4xx 0.0
1377652194 BUG_BUG.http_5xx 0.0
[cosmo:/tmp]$

and the corresponding /var/log/logster/logster.log

2013-08-27 20:09:22,492 INFO     Executing parser logster.parsers.SampleLogster.SampleLogster on logfile /tmp/access.log
2013-08-27 20:09:22,492 DEBUG    Using state file /tmp/logster/logtail-logster.parsers.SampleLogster.SampleLogster-tmp-access.log.state
2013-08-27 20:09:22,493 DEBUG    Locking successful
2013-08-27 20:09:22,493 DEBUG    Setting duration to 437.0 seconds.
2013-08-27 20:09:22,512 DEBUG    Submitting Graphite metric: http_1xx 0.0 1377652162
2013-08-27 20:09:22,512 DEBUG    Submitting Graphite metric: http_2xx 0.0 1377652162
2013-08-27 20:09:22,513 DEBUG    Submitting Graphite metric: http_3xx 0.0 1377652162
2013-08-27 20:09:22,513 DEBUG    Submitting Graphite metric: http_4xx 0.0 1377652162
2013-08-27 20:09:22,513 DEBUG    Submitting Graphite metric: http_5xx 0.0 1377652162
2013-08-27 20:09:22,514 DEBUG    Submitting statsd metric: http_1xx:0.0|g
2013-08-27 20:09:22,514 DEBUG    Submitting statsd metric: http_2xx:0.0|g
2013-08-27 20:09:22,514 DEBUG    Submitting statsd metric: http_3xx:0.0|g
2013-08-27 20:09:22,515 DEBUG    Submitting statsd metric: http_4xx:0.0|g
2013-08-27 20:09:22,515 DEBUG    Submitting statsd metric: http_5xx:0.0|g
2013-08-27 20:09:22,515 INFO     Total execution time: 0.0 seconds.
2013-08-27 20:09:22,515 DEBUG    Unlocking successful

2013-08-27 20:09:54,159 INFO     Executing parser logster.parsers.SampleLogster.SampleLogster on logfile /tmp/access.log
2013-08-27 20:09:54,159 DEBUG    Using state file /tmp/logster/logtail-logster.parsers.SampleLogster.SampleLogster-tmp-access.log.state
2013-08-27 20:09:54,159 DEBUG    Locking successful
2013-08-27 20:09:54,160 DEBUG    Setting duration to 32.0 seconds.
2013-08-27 20:09:54,180 DEBUG    Submitting Graphite metric: BUG.http_1xx 0.0 1377652194
2013-08-27 20:09:54,180 DEBUG    Submitting Graphite metric: BUG.http_2xx 0.0 1377652194
2013-08-27 20:09:54,180 DEBUG    Submitting Graphite metric: BUG.http_3xx 0.0 1377652194
2013-08-27 20:09:54,180 DEBUG    Submitting Graphite metric: BUG.http_4xx 0.0 1377652194
2013-08-27 20:09:54,180 DEBUG    Submitting Graphite metric: BUG.http_5xx 0.0 1377652194
2013-08-27 20:09:54,181 DEBUG    Submitting statsd metric: BUG.BUG_BUG.http_1xx:0.0|g
2013-08-27 20:09:54,181 DEBUG    Submitting statsd metric: BUG.BUG_BUG.http_2xx:0.0|g
2013-08-27 20:09:54,181 DEBUG    Submitting statsd metric: BUG.BUG_BUG.http_3xx:0.0|g
2013-08-27 20:09:54,181 DEBUG    Submitting statsd metric: BUG.BUG_BUG.http_4xx:0.0|g
2013-08-27 20:09:54,181 DEBUG    Submitting statsd metric: BUG.BUG_BUG.http_5xx:0.0|g
2013-08-27 20:09:54,181 INFO     Total execution time: 0.0 seconds.
2013-08-27 20:09:54,181 DEBUG    Unlocking successful

Depends on logtail package, not logcheck.

The README states:

Logster depends on the "logtail" utility that can be obtained from the logcheck package, either from a Debian package manager or from source:

But this actually uses the logtail2 executable by default, which is provided by the 'logtail' package (at least in Ubuntu Precise).

Logster does not process lines on first call with new file

I create a file, call it "logfile" with just 3 lines in it. "ParserLogster.py" contains nothing but a print(line) in parse_line().

Running
logster --output=stdout ParserLogster logfile
Does not produce any output the first time. Running it again prints out all the lines.

The default error log format has changed; the parser isn't getting it

The default format of the error log has changed from something like
[Thu May 12 08:28:57.652118 2011] [error] ...
to
[Thu May 12 08:28:57.652118 2011] [core:error] ...

Note the new module info. The ErrorLogLogster parser should be extended to understand this (i.e. probably ignore the module and successfully extract the severity).

Add timestamp parameter to MetricObject

Right now I am parsing when the server has been restarted. From the logfile I have extracted the timestamp. I would like to use this timestamp in stead of the timestamp when MetricObject is created.

Thx in advance

Metric is different than supposed to be.

I've created empty file for test and run logster like this:
logster --dry-run -o stdout MetricLogster /tmp/diff_log

Then I've put data into test log file as in example:

METRIC_COUNT metric=some.metric.count value=1
METRIC_COUNT metric=some.metric.count value=2.2

and run logster again and it gave me this output:
some.metric.count 0.2

It's written that COUNT metrics are totalled which should give 3.2.

Why it's not working as intended ?

version:
ii logster 0.0.1-1 all Generate metrics from logfiles for Graphite and G

Installation documentation is not up-to-date

Hi

After sys.path.append("/usr/share/logster") has been removed from logster and logster/parsers has been moved

I can't just call

sudo make install

I have to run
python setup.py install instead

Log4jLogster Parse_line not getting called

I am running Log4jLogster on my log file. If I write code in init function then the code changes are reflecting in output but when I try to change Parse_Line function then it does not have any effect. It seems as if it is not able to read the log file being passed in command line. Please help me out so that I can keep using Logster with my large sized logs.

Please tag a version number

As mentioned in #92, I've asked Enthought to include logster (and pygtail and portalocker) in a Canopy repo. They've agreed to do so but would appreciate if you could tag a version. For obvious reasons they don't want to pick an arbitrary point (would you bless one instead?) and the constant version number of 0.0.1 isn't too convenient for them either.

Thanks,
Sam

Remove old lines logs than X days

Hi everyone,

I'm using logster and graphite in order to visualize the code response of HTTP. But there is a problem : size of file log grows very fast, so I want remove old lines . I tried by a script shell, it keep only 5000 lines and remove all old lines . But it didn't work. Is there a solution for this one ?

Thanks and sorry my poor english ^^

Python3 compatibility

isn't working ๐Ÿ˜ž

copying build/lib/logster/parsers/__init__.py -> build/bdist.linux-x86_64/egg/logster/parsers
copying build/lib/logster/parsers/ErrorLogLogster.py -> build/bdist.linux-x86_64/egg/logster/parsers
copying build/lib/logster/parsers/stats_helper.py -> build/bdist.linux-x86_64/egg/logster/parsers
copying build/lib/logster/parsers/Log4jLogster.py -> build/bdist.linux-x86_64/egg/logster/parsers
copying build/lib/logster/parsers/SquidLogster.py -> build/bdist.linux-x86_64/egg/logster/parsers
copying build/lib/logster/parsers/PostfixLogster.py -> build/bdist.linux-x86_64/egg/logster/parsers
copying build/lib/logster/parsers/MetricLogster.py -> build/bdist.linux-x86_64/egg/logster/parsers
copying build/lib/logster/parsers/SampleLogster.py -> build/bdist.linux-x86_64/egg/logster/parsers
byte-compiling build/bdist.linux-x86_64/egg/logster/__init__.py to __init__.cpython-32.pyc
byte-compiling build/bdist.linux-x86_64/egg/logster/logster_helper.py to logster_helper.cpython-32.pyc
byte-compiling build/bdist.linux-x86_64/egg/logster/parsers/__init__.py to __init__.cpython-32.pyc
byte-compiling build/bdist.linux-x86_64/egg/logster/parsers/ErrorLogLogster.py to ErrorLogLogster.cpython-32.pyc
  File "build/bdist.linux-x86_64/egg/logster/parsers/ErrorLogLogster.py", line 55
    raise LogsterParsingException, "regmatch failed to match"
                                 ^
SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/logster/parsers/stats_helper.py to stats_helper.cpython-32.pyc
byte-compiling build/bdist.linux-x86_64/egg/logster/parsers/Log4jLogster.py to Log4jLogster.cpython-32.pyc
  File "build/bdist.linux-x86_64/egg/logster/parsers/Log4jLogster.py", line 80
    raise LogsterParsingException, "regmatch failed to match"
                                 ^
SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/logster/parsers/SquidLogster.py to SquidLogster.cpython-32.pyc
  File "build/bdist.linux-x86_64/egg/logster/parsers/SquidLogster.py", line 89
    raise LogsterParsingException, "regmatch failed to match"
                                 ^
SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/logster/parsers/PostfixLogster.py to PostfixLogster.cpython-32.pyc
  File "build/bdist.linux-x86_64/egg/logster/parsers/PostfixLogster.py", line 61
    except Exception, e:
                    ^
SyntaxError: invalid syntax

byte-compiling build/bdist.linux-x86_64/egg/logster/parsers/MetricLogster.py to MetricLogster.cpython-32.pyc
byte-compiling build/bdist.linux-x86_64/egg/logster/parsers/SampleLogster.py to SampleLogster.cpython-32.pyc
  File "build/bdist.linux-x86_64/egg/logster/parsers/SampleLogster.py", line 72
    raise LogsterParsingException, "regmatch failed to match"
                                 ^
SyntaxError: invalid syntax

creating build/bdist.linux-x86_64/egg/EGG-INFO
installing scripts to build/bdist.linux-x86_64/egg/EGG-INFO/scripts
running install_scripts
running build_scripts
creating build/bdist.linux-x86_64/egg/EGG-INFO/scripts
copying build/scripts-3.2/logster -> build/bdist.linux-x86_64/egg/EGG-INFO/scripts
changing mode of build/bdist.linux-x86_64/egg/EGG-INFO/scripts/logster to 755
copying logster.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying logster.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying logster.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying logster.egg-info/not-zip-safe -> build/bdist.linux-x86_64/egg/EGG-INFO
copying logster.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
creating 'dist/logster-0.0.1-py3.2.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing logster-0.0.1-py3.2.egg
removing '/opt/logster/vev/lib/python3.2/site-packages/logster-0.0.1-py3.2.egg' (and everything under it)
creating /opt/logster/vev/lib/python3.2/site-packages/logster-0.0.1-py3.2.egg
Extracting logster-0.0.1-py3.2.egg to /opt/logster/vev/lib/python3.2/site-packages
  File "/opt/logster/vev/lib/python3.2/site-packages/logster-0.0.1-py3.2.egg/logster/parsers/ErrorLogLogster.py", line 55
    raise LogsterParsingException, "regmatch failed to match"
                                 ^
SyntaxError: invalid syntax

  File "/opt/logster/vev/lib/python3.2/site-packages/logster-0.0.1-py3.2.egg/logster/parsers/Log4jLogster.py", line 80
    raise LogsterParsingException, "regmatch failed to match"
                                 ^
SyntaxError: invalid syntax

  File "/opt/logster/vev/lib/python3.2/site-packages/logster-0.0.1-py3.2.egg/logster/parsers/SquidLogster.py", line 89
    raise LogsterParsingException, "regmatch failed to match"
                                 ^
SyntaxError: invalid syntax

  File "/opt/logster/vev/lib/python3.2/site-packages/logster-0.0.1-py3.2.egg/logster/parsers/PostfixLogster.py", line 61
    except Exception, e:
                    ^
SyntaxError: invalid syntax

  File "/opt/logster/vev/lib/python3.2/site-packages/logster-0.0.1-py3.2.egg/logster/parsers/SampleLogster.py", line 72
    raise LogsterParsingException, "regmatch failed to match"
                                 ^
SyntaxError: invalid syntax

logster 0.0.1 is already the active version in easy-install.pth
Installing logster script to /opt/logster/vev/bin

Installed /opt/logster/vev/lib/python3.2/site-packages/logster-0.0.1-py3.2.egg
Processing dependencies for logster==0.0.1
Finished processing dependencies for logster==0.0.1
(vev)[soporte@v455uprod logster]$ logster
Traceback (most recent call last):
  File "/opt/logster/vev/bin/logster", line 5, in <module>
    pkg_resources.run_script('logster==0.0.1', 'logster')
  File "/opt/logster/vev/lib/python3.2/site-packages/pkg_resources.py", line 534, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/opt/logster/vev/lib/python3.2/site-packages/pkg_resources.py", line 1434, in run_script
    execfile(script_filename, namespace, namespace)
  File "/opt/logster/vev/lib/python3.2/site-packages/pkg_resources.py", line 55, in execfile
    exec(compile(open(fn).read(), fn, 'exec'), globs, locs)
  File "/opt/logster/vev/lib/python3.2/site-packages/logster-0.0.1-py3.2.egg/EGG-INFO/scripts/logster", line 194
    print "%s %s %s" %(metric.timestamp, metric_name, metric.value)
                   ^
SyntaxError: invalid syntax

python2 compatibility in graphite and statsd output

hi, this commit b172276 breaks the compatibility for python2

if (not self.dry_run):
    s.sendall(bytes("%s\n" % metric_string, 'ascii'))
else:
    print("%s %s" % (self.graphite_host, metric_string))            
>>> bytes('foo', 'ascii')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
TypeError: str() takes at most 1 argument (2 given)

add new feature for amazon cloudwatch

I forked logster and added new feature for amazon cloudwatch.
And I used this feature from last year on my production service.
Until now, I used this feature alone but I'd like to share code.

Plz review this idea.

Logster does not accept statsd-host option

Logster does not understand --statsd-host even when using --output=statsd.

me@my-macbook ~/Source $ virtualenv foo
me@my-macbook ~/Source $ source foo/bin/activate
(foo) me@my-macbook ~/Source $ git clone https://github.com/etsy/logster && cd logster
(foo) me@my-macbook ~/Source/logster $ logster -d --statsd-host=foo:8125 --output=statsd SampleLogster /path/to/file.log
Usage: logster [options] parser logfile

logster: error: no such option: --statsd-host

(foo) me@my-macbook ~/Source/logster $ logster -d --output=statsd SampleLogster /path/to/file.log
Usage: logster [options] parser logfile
...
  StatsdOutput options:
    --statsd-host=STATSD_HOST
                        Hostname and port for statsd collector, e.g.
                        statsd.example.com:8125
Usage: logster [options] parser logfile

logster: error: You must supply --statsd-host when using 'statsd' as an output type.

This appears to have regressed sometime between the introduction of the statsd (68e26f3) and the recent commit.

This issue does not occur if I use 68e26f3.

MetricParser requires characters before and after metric command

If i just want to publish metrics then i have to log:

$logger->info(" METRIC_COUNT metric=foo value=1 ");

Why is this necessary? couldn't the regexp allow no spaces as well? This is a source of bugs in our code where metrics don't get published because people forget to add spaces around them.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.