title: Logging to logstash from python
body: <p>I am having some troubles logging to logstash from python.</p>
  
  <p>I am using a docker image from sebp/elk (<a href="http://elk-docker.readthedocs.io" rel="noreferrer">http://elk-docker.readthedocs.io</a>) and python-logstash (<a href="https://pypi.python.org/pypi/python-logstash" rel="noreferrer">https://pypi.python.org/pypi/python-logstash</a>) as a logging handler</p>
  
  <p>The docker image exposes port 5044 for the Beats interface (<a href="http://elk-docker.readthedocs.io/#usage" rel="noreferrer">http://elk-docker.readthedocs.io/#usage</a>). Whenever I try to log to this port <strong>nothing</strong> happens... Is there some other port I should be using ?</p>
  
  <p>I have verified that logstash works by doing this:</p>
  
  <pre><code>/opt/logstash/bin/logstash -e 'input { stdin { } } output { elasticsearch   { hosts =&gt; ["localhost"] } }' --path.data /root/data
  </code></pre>
  
  <p>Python code (official example from python-logstash):</p>
  
  <pre><code>import logging
  from logging import StreamHandler
  import logstash
  import sys
  
  host = 'localhost'
  
  test_logger = logging.getLogger('python-logstash-logger')
  test_logger.setLevel(logging.INFO)
  test_logger.addHandler(logstash.TCPLogstashHandler(host, 5044, version=1))
  test_logger.addHandler(StreamHandler())
  
  try:
      test_logger.error('python-logstash: test logstash error message.')
      test_logger.info('python-logstash: test logstash info message.')
      test_logger.warning('python-logstash: test logstash warning message.')
  
      # add extra field to logstash message
      extra = {
          'test_string': 'python version: ' + repr(sys.version_info),
          'test_boolean': True,
          'test_dict': {'a': 1, 'b': 'c'},
          'test_float': 1.23,
          'test_integer': 123,
          'test_list': [1, 2, '3'],
      }
      test_logger.info('python-logstash: test extra fields', extra=extra)
  except:
      print("Error")
  </code></pre>
  
  <p>I have no clue why this is not working. Does it possibly have something to do with Beats?</p>