MoinMoin Logo
  • Comments
  • Immutable Page
  • Menu
    • Navigation
    • RecentChanges
    • FindPage
    • Local Site Map
    • Help
    • HelpContents
    • HelpOnMoinWikiSyntax
    • Display
    • Attachments
    • Info
    • Raw Text
    • Print View
    • Edit
    • Load
    • Save
  • Login

Navigation

  • Start
  • Sitemap
Revision 2 as of 2013-12-10 13:21:37
  • Graylog2

Graylog2

Graylog2 is an open source log management solution that stores your logs in ElasticSearch.

Clean up DB

http://wiki.hackspherelabs.com/index.php?title=Graylog2#Clean_Out_Graylog2_DB

"Cure" for high CPU usage:

  • service graylog2 stop
  • cd /opt/elasticsearch-0.19.9/data/graylog2
  • rm * -rf
  • /opt/mongo/bin/mongo
  • use graylog2
  • db.message_counts.remove()
  • db.hosts.remove()
  • exit
  • service graylog2 start

Send log from python to graylog2 through GELF

See details in https://pypi.python.org/pypi/graypy

Install with easy_install graypy .

   1 #file name testGelf.py
   2 import logging
   3 import graypy
   4 
   5 my_logger = logging.getLogger('test_logger')
   6 my_logger.setLevel(logging.DEBUG)
   7 
   8 handler = graypy.GELFHandler('192.168.1.123', 12201)
   9 my_logger.addHandler(handler)
  10 
  11 my_logger.debug('Hello Graylog2.')

On graylog2 the following columns are used:

  • Severity: Debug
  • Facility: test_logger
  • File: testGelf.py:10
  • thread_name: MainThread

  • function: <module>

  • process_name: MainProcess

  • pid: 27663
  • MoinMoin Powered
  • Python Powered
  • GPL licensed
  • Valid HTML 4.01