Gunicorn logstash log handler
<p>my log config file</p>

<pre><code>[loggers]
keys=root, logstash

[handlers]
keys=console , logstash

[formatters]
keys=generic, access

[logger_root]
level=INFO
handlers=console

[logger_logstash]
level=DEBUG
handlers=logstash
propagate=1
qualname=logstash


[handler_console]
class=StreamHandler
formatter=generic
args=(sys.stdout, )

[handler_logstash]
class=logstash.TCPLogstashHandler
formatter=generic
args=('localhost',5959)


[formatter_generic]
format=%(asctime)s [%(process)d] [%(levelname)s] %(message)s
datefmt=%Y-%m-%d %H:%M:%S
class=logging.Formatter

[formatter_access]
format=%(message)s
class=logging.Formatter
</code></pre>

<p>my command to execute</p>

<pre><code>gunicorn --env DJANGO_SETTINGS_MODULE=myproject.settings myproject.wsgi --log-level debug --log-file=- --log-config gunicorn_log.conf
</code></pre>

<p>I am not getting any error but logstash is not receiving access logs.
This handler worked with DJango and celery but I am helpless with gunicorn</p>

<p>Based on <a href="https://github.com/vklochan/python-logstash#using-with-django" rel="nofollow">python-logstash documentation</a>:</p>

<pre><code>[handler_logstash]
class=logstash.TCPLogstashHandler
formatter=generic
host=localhost
port=5959
version=1
</code></pre>

python django logging logstash gunicorn