Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

421
Vistas
Django + Elastic Beanstalk, 500 Response codes in access_log but nothing in error_log

I have an application setup on Elastic Beanstalk (with an auto-scaling load balancer) using Django. The configuration also uses apache httpd and mod_wsgi.

The app functions correctly but I am seeing an occasional error that for the life of me I cannot debug. This is due to the error itself not appearing in the error_log at any point.

A sample from the access log, (IP addresses omitted):

[15/Apr/2020:01:13:21 +0000] "GET /reroute/agument/ HTTP/1.1" 500 27 "-" ""
[15/Apr/2020:01:13:22 +0000] "GET /reroute/argument/ HTTP/1.1" 302 - "https://www.bing.com/" "Mozilla/5.0 (Linux; Android 4.4.3; KFSOWI) AppleWebKit/537.36 (KHTML, like Gecko) Silk/80.5.3 like Chrome/80.0.3987.162 Safari/537.36"

The top request shows an error request, the bottom a typical request. The main thing I notice here is the absence of a user-agent in the 500 request. Combing through the access_log, every single request of this type is missing the user-agent. I have no specific functionality setup to deter bots/spiders or the like.

These 500 errors happen randomly and have been doing so for the last few months. There have been no reports of these occurring with the end user, which leads me to believe two possibilities:

  1. An incorrect host not specified in Django's ALLOWED_HOSTS setting is being used by someone.
  2. Somehow, a bot/spider is being rejected.

I really want to identify and stop these erroneous requests as it is affecting error reporting for the app itself. What would be the best way to identify the issue here?

The only functionality I have added to my beanstalk environment (through .ebextensions) is:

  • Redirecting Http requests to Https
  • Some Django commands to run on startup
over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

OK, so I'm dumb.

The reasons why these error messages were not appearing in my logs was simply a case of them not having a means to be displayed in the logs.

Setting up a simple logging dictionary in Django settings.py suddenly started displaying the stack traces of the 500 errors when they happened. From there, I could see it was a simple unhandled exception:

LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"handlers": {
    "console": {
        "class": "logging.StreamHandler",
    },
},
"loggers": {
    "django": {"handlers": ["console"], "level": "INFO"},
},

}

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda