Skip to content

django-fluentd allows you to use django's logging framework to log directly to a fluentd server of your choice.

Notifications You must be signed in to change notification settings

blubbi321/django-fluentd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-fluentd

django-fluentd allows you to use django's logging framework to log directly to a fluentd server of your choice.

Please consider the package as unstable and don't use it for production, yet.

Installation

with pip:

pip install django-fluentd

or

with setup.py:

git clone https://github.com/jayfk/django-fluentd.git
cd django-fluentd
python setup.py install

Configuration

Add the following to your settings.py:

DJANGO_FLUENTD_SERVER = "10.10.10.10"
DJANGO_FLUENTD_PORT = 24224 #no string
DJANGO_FLUENTD_TAG = "your_fluentd_tag"

Add the fluentd handler to your LOGGING dict in your settings.py and add this handler to one of your loggers:

LOGGING = {

  ...

  'handlers':{
      'fluentd': {
          'level': 'DEBUG',
          'class': 'django_fluentd.handler.FluentdHandler',
      },
  }

  ...

  'loggers': {
      'django': {
          'handlers': ['fluentd',],
          'level': 'DEBUG',
          'propagate': False,
      },
  },
}

If you want to capture all logging messages using fluentd, you can add a root handler:

LOGGING = {
  ...

  'root': {
        'level': 'DEBUG',
        'handlers': ['fluentd'],
    },

  ...
}

Further information on how to use django's logging framework can be found here: https://docs.djangoproject.com/en/dev/topics/logging/

Fluentd Server Setup

Your Fluentd Server should listen on the ip and the port you specified in DJANGO_FLUENTD_SERVER and DJANGO_FLUENTD_PORT:

<source>
 type forward
 port 24224
 bind 10.10.10.10
</source>

Please not that you currently can't use fluentd's secure_forward. If you want to send encrypted or authenticated messages to another fluentd server on the net, you'll have to add a local fluentd server that accepts unencrypted messages and forwards them using secure_forward:

<source>
 type forward
 port 24224
 bind 10.10.10.10
</source>

<match **>
  type secure_forward
  shared_key foobar
  self_hostname example.org
  send_timeout 60s
  recover_wait 10s
  heartbeat_interval 1s
  phi_threshold 8
  hard_timeout 60s

  <server>
    name remote_server_name
    host 10.10.10.11
    port 24224
    username your_username
    password your_password
  </server>

</match>

Further information on how to use fluentd can be found here: http://fluentd.org/

About

django-fluentd allows you to use django's logging framework to log directly to a fluentd server of your choice.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 88.9%
  • HTML 11.1%