Pre requirements:

I launched EC2 with the pre-baked AMI community created.
ami-060741a96307668be

My trouble:

Redash works well everything, dashboard, data source setting and executing query.
Just I cannot change the setting of REDASH_LOG_LEVEL.

By the default, REDASH_LOG_LEVEL is set as INFO in “/opt/redash/env”.
I set WARNING in “/opt/redash/env”, and docker-compose down && docker-compose up -d was done.

I checked that the containers have enviroment variable of REDASH_LOG_LEVEL=WARNING.
But the containers still output INFO logging.

This situation is beginner’s. Where is my misunderstand how to set enviroment variables of the containers?
I wait for your any advise.

(some information is below)

##redash_server container
# docker inspect c45908a08401| jq '.[].Config.Env'
[
  "PYTHONUNBUFFERED=0",
  "REDASH_LOG_LEVEL=WARNING",
  "REDASH_REDIS_URL=redis://redis:6379/0",
  "POSTGRES_PASSWORD=~~",
  "REDASH_COOKIE_SECRET=~~",
  "REDASH_SECRET_KEY=~~",
  "REDASH_DATABASE_URL=postgresql://postgres:~~@postgres/postgres",
  "REDASH_WEB_WORKERS=4",
  "PATH=/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  "LANG=C.UTF-8",
  "PYTHONIOENCODING=UTF-8",
  "GPG_KEY=C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF",
  "PYTHON_VERSION=2.7.16",
  "PYTHON_PIP_VERSION=19.2.2",
  "PYTHON_GET_PIP_URL=https://github.com/pypa/get-pip/raw/0c72a3b4ece313faccb446a96c84770ccedc5ec5/get-pip.py",
  "PYTHON_GET_PIP_SHA256=201edc6df416da971e64cc94992d2dd24bc328bada7444f0c4f2031ae31e8dad"
]
#
# docker logs c45908a08401
[2020-01-22 09:20:07 +0000] [1] [INFO] Starting gunicorn 19.7.1
[2020-01-22 09:20:07 +0000] [1] [INFO] Listening at: http://0.0.0.0:5000 (1)
[2020-01-22 09:20:07 +0000] [1] [INFO] Using worker: sync
[2020-01-22 09:20:07 +0000] [9] [INFO] Booting worker with pid: 9
[2020-01-22 09:20:07 +0000] [11] [INFO] Booting worker with pid: 11
[2020-01-22 09:20:07 +0000] [13] [INFO] Booting worker with pid: 13
[2020-01-22 09:20:07 +0000] [14] [INFO] Booting worker with pid: 14
[2020-01-22 09:56:52,972][PID:9][ERROR][pyathena.common] Failed to execute query.
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/pyathena/common.py", line 202, in _execute
    **request).get('QueryExecutionId', None)
  File "/usr/local/lib/python2.7/site-packages/pyathena/util.py", line 57, in retry_api_call
    return retry(func, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/tenacity/__init__.py", line 358, in call
    do = self.iter(retry_state=retry_state)
  File "/usr/local/lib/python2.7/site-packages/tenacity/__init__.py", line 319, in iter
    return fut.result()
  File "/usr/local/lib/python2.7/site-packages/concurrent/futures/_base.py", line 455, in result
    return self.__get_result()
  File "/usr/local/lib/python2.7/site-packages/tenacity/__init__.py", line 361, in call
    result = fn(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 661, in _make_api_call
    raise error_class(parsed_response, operation_name)
InvalidRequestException: An error occurred (InvalidRequestException) when calling the StartQueryExecution operation: outputLocation is not a valid S3 path. Provided xxxxx
#

I’m fairly sure Redash uses Python logging, so “WARNING” is not a valid log level, you need to use “WARN”.

However, this will still output INFO messages as this is the standard logging behavior, i.e. all log messages at the specified level OR ABOVE will be captured.

See this tutorial for more details https://www.toptal.com/python/in-depth-python-logging

1 Like