2

I'm trying to save the erros/info in graylog using python flask. I did something in my code. First, I imported the graylog using pip. then, I tried to config the graylog.But, I can't.

How could we config graylog in flask?

sam ruben
  • 365
  • 2
  • 6

1 Answers1

3

Use graypy for python

Python logging handlers that send messages in the Graylog Extended Log Format (GELF).

Installation Using pip

Install the basic graypy for python logging handlers

pip install graypy

some demo code -

import logging
import graypy
my_logger = logging.getLogger('test_logger')
my_logger.setLevel(logging.DEBUG)
handler = graypy.GELFUDPHandler('localhost', 12201)
my_logger.addHandler(handler)
my_logger.debug('Hello Graylog2.')