Application performance lower after fixing agent logger level from warning to info

Hey, I'm currently doing instrumentation of service and detects some errors rn..
my elastic versions are like below and the problem is when agent comes to the version of 5.3.3 and turn log level from warning to info. The application used to take 2 secs but after changing agent log level to info(elasticapm), it takes more than 6 secs which is too long to open the service.
i assume that since all info level logs are sent to server, the performance might be lower but how can i make it faster??

Kibana version:
7.6.1
Elasticsearch version:
7.6.1
APM Server version:
7.6.1
APM Agent language and version:
python(django), 5.3.3
Browser version:

--- DJANGO BASE.PY ---


MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'elasticapm.contrib.django.middleware.TracingMiddleware',
    'elasticapm.contrib.django.middleware.Catch404Middleware',
    'corsheaders.middleware.CorsMiddleware',
]

LOGGING = {'version': 1,
           'disable_existing_loggers': False,
           'formatters': {
               'verbose': {
                   'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
                   'datefmt' : "%d/%b/%Y %H:%M:%S"
               },
               'simple': {
                   'format': '%(levelname)s %(message)s'
               },
           },
           'handlers': {'file': {'level': 'DEBUG',
                                 'class': 'logging.handlers.TimedRotatingFileHandler',
                                 'when' : 'H',
                                 'backupCount': 100,
                                 'filename': LOG_FILE_NAME,
                                 'formatter': 'verbose',
                                 },
                        'console': {
                                    'level': 'DEBUG',
                                    'class': 'logging.StreamHandler',
                                    'formatter': 'verbose',
                                   },
                        'elasticapm': {
                                      'level': 'INFO', (#### <- HERE )
                                      'class': 'elasticapm.contrib.django.handlers.LoggingHandler',
                                  },
                      },
           'loggers': {
                       'apm.errors': {
                           'level': 'ERROR',
                           'handlers': ['console', 'file'],
                           'propagate': False,
                       },
                       'django.db.backends': {
                           'level': 'ERROR',
                           'handlers': ['file'], # 'console',
                           'propagate': False,
                       },
                       'django': {'handlers': ['console', 'elasticapm','file'], #'console',
                                  'level': 'INFO',
                                  'propagate': True,
                                  },
                       'celery': {'handlers': ['console','elasticapm','file'], #'console',
                                  'level': 'INFO',
                                  'propagate': True,
                                  },
                       'ssg_imgr_app': {
                                    'handlers': ['console', 'elasticapm', 'file'],
                                    'level': 'INFO',
                                    'propagate': True,
                                    },
                       'ssg-ocr-app': {
                           'level': 'INFO',
                           'handlers': ['console', 'elasticapm', 'file'], #'console',
                           'propagate': True,
                       },
           },
}

Welcome to the community, @jinner! Thanks for the question.

Unfortunately, the python agent isn't tuned for sending of mass amounts of logs to Elasticsearch. We provide the elasticapm LoggingHandler for the convenience of easily being able to send error logs out of the box, but if you'd like to ingest more logs from your app we recommend using filebeat. It is much more efficient and won't impact your app's performance in the same way that shipping those logs with the agent will.

1 Like

Thanks! maybe i should think about using filebeat..! btw, is there any recommended size of logs(just for information)

I'm not sure I understand. What do you mean by "size of logs"?

Oops, i understood elasticapm LoggingHandler is not able to ingest much amount of logs or effects application performance according to your mention above.
[Unfortunately, the python agent isn't tuned for sending of mass amounts of logs to Elasticsearch. We provide the elasticapm LoggingHandler for the convenience of easily being able to send error logs out of the box, but if you'd like to ingest more logs from your app we recommend using filebeat]
so what i meant "size of logs" is, maximum size of logs that agent easily handle. But seems like only error or transaction logs are recommended to ingest..! Thank you very much

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.