# INFO logs being sent as error logs

**URL:** <https://discuss.elastic.co/t/info-logs-being-sent-as-error-logs/341101>\
**Category:** Elastic Agent\
**Created:** [August 18, 2023, 2:08pm UTC](https://discuss.elastic.co/t/info-logs-being-sent-as-error-logs/341101 "2023-08-18T14:08:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcoaleixo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marcoaleixo/32/94499_2.png) [@marcoaleixo](https://discuss.elastic.co/u/marcoaleixo)\
**Post date:** [August 18, 2023, 2:08pm UTC](https://discuss.elastic.co/t/info-logs-being-sent-as-error-logs/341101/1 "2023-08-18T14:08:40Z")

</div>

hey team, I have my Fleet configured using ElasticCloud and I need to configure the elastic-agent on my Django project where I'm configuring my logging like:

```auto
ELASTIC_APM = {
   'SERVICE_NAME': 'alan-backend',
   'SERVER_URL': 'myapmserver',
   'SECRET_TOKEN': 'sercrettoken',
   'DEBUG': True,
   'ENVIRONMENT': ENVIROMENT,
   'ELASTIC_APM_LOG_LEVEL': 'DEBUG',
}

LOGGING = {  
    'version': 1,  
    'disable_existing_loggers': False,  
    'formatters': {  
        'verbose': {  
            'format': f"%(levelname)s %(asctime)s - %(module)s - %(message)s"  
        },  
    },  
    'handlers': {  
        'elasticapm': {  
            'level': 'INFO',  
            'class': 'elasticapm.contrib.django.handlers.LoggingHandler',  
        },  
        'console': {  
            'level': 'DEBUG',  
            'class': 'logging.StreamHandler',  
            'formatter': 'verbose'  
        },  
        'file': {
            'level': 'INFO',  
            'class': 'logging.FileHandler',  
            'filename': '/logs/alan_backend.log',  
            'formatter': 'verbose',  
        },  
    },  
    'loggers': {  
        'django.db.backends': {  
            'level': 'ERROR',  
            'handlers': ['console'],  
            'propagate': False,  
        },  
        'alan_backend': {  
            'handlers': ['console', 'elasticapm', 'file'],  
            'level': 'DEBUG',  
            'propagate': False,  
        },  
        'elasticapm.errors': {  
            'level': 'ERROR',  
            'handlers': ['console'],  
            'propagate': False,  
        },  
    },  
}

```

And I have my docker compose

```auto
... my alanbackend container writing the logs to ./logs/logs/alan_backend.logs...

 elastic_agent:  
    image: docker.elastic.co/beats/elastic-agent:8.4.3
    container_name: elastic_agent
    volumes:
      - ./logs:/logs:ro
    environment:  
      - FLEET_URL=https://myfleetelasticcloudurl.com
      - ELASTICSEARCH_USERNAME=elastic
      - ELASTICSEARCH_PASSWORD=password
      - FLEET_ENROLLMENT_TOKEN=token
      - FLEET_ENROLL=1
    ports:  
      - 8220:8220  
    command: ["elastic-agent", "run"]
  
  # filebeat:  
  # image: docker.elastic.co/beats/filebeat:8.4.3
  # container_name: filebeat  
  # user: root
  # configs:
  # - source: fb_config
  # target: /usr/share/filebeat/filebeat.yml
  # volumes:  
  # # - ./filebeat.yml:/usr/share/filebeat/filebeat.yml:ro  
  # - ./logs:/logs:ro  
  # - filebeat_data:/usr/share/filebeat/data
  # - /var/run/docker.sock:/var/run/docker.sock
  # # This is needed for filebeat to load container log path as specified in filebeat.yml
  # - /var/lib/docker/containers/:/var/lib/docker/containers/:ro
  # - /var/log/audit/:/var/log/audit/:ro
  # - /var/log/:/var/log/:ro
  # command: ["--strict.perms=false"]
  # depends_on:  
  # - alan_backend 

```

I have filebeat commented because I'm not sure if I should use it or not, but here we go.

Right now I'm able to see all my transactions via APM, but the point is that all my logger.info() calls that I'm doing on my Django project are being sent as ERROR ( maybe because of 'ELASTIC\_APM\_LOG\_LEVEL': 'DEBUG', ?! )

 ![Screenshot 2023-08-18 at 11.07.04](https://us1.discourse-cdn.com/elastic/original/3X/3/2/327d11c6ea44d745a2e40bf703df5d3b3e62add2.png)

my elastic-agent.yml

```auto
agent.monitoring:
  enabled: true 
  logs: true 
  metrics: true 
  http:
      enabled: true 
      host: localhost 
      port: 6791

# agent.inputs:
# - type: log  
# enabled: true  
# paths:  
# - /logs/alan_backend.log

```

not sure about the agent.inputs  
and it's not 100% clear for me if I need to use only elastic-agent or if I need filebeat AND elastic-agent

additional info:

 ![Screenshot 2023-08-18 at 11.11.11](https://us1.discourse-cdn.com/elastic/original/3X/a/7/a75ccc3cbe171152d4dc4de3b6bdd819c1fb13f9.png)

 ![Screenshot 2023-08-18 at 11.10.18](https://us1.discourse-cdn.com/elastic/original/3X/4/7/47dbe972d2c13fffa40cea857e3532a93df34788.png)

I mean, i tried for several hours reading a lot of documentations but still not clear how achieve the result of being able to see all my INFO logs AND getting the ERROR logs being handled errors so I can create monitors and all the stuff.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 15, 2023, 2:09pm UTC](https://discuss.elastic.co/t/info-logs-being-sent-as-error-logs/341101/2 "2023-09-15T14:09:35Z")

</div>

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