How to add a custom parser to logster?

724 Views Asked by At

I want to track the HTTP response codes returned by my nginx web-server, using logster.

1) I found and installed logster. I also pip-installed pygtail, which is required for logster.

https://github.com/etsy/logster

2) I found a python script that parses nginx access_log and placed it in the parsers subdir.

https://github.com/metabrainz/logster/blob/master/musicbrainz/logster/NginxStatus.py

...but when I run the logster command, I get a python exception:

Traceback (most recent call last):
  File "/usr/local/bin/logster", line 5, in <module>
    pkg_resources.run_script('logster==0.0.1', 'logster')
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 505, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1245, in run_script
    execfile(script_filename, namespace, namespace)
  File "/usr/local/lib/python2.7/dist-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 449, in <module>
    main()
  File "/usr/local/lib/python2.7/dist-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 380, in main
    module = __import__(module_name, globals(), locals(), [parser_name])
ImportError: No module named NginxStatus1

````

What am I doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

The exception error was rather misleading: the file was placed in the right place (the parsers subdir), but - as it turns out- logster must be re-setup after a new parser is added (this isn't documented, unfortunately). so just run:

sudo python setup.py install

in the logster directory and things should start working correctly.