I have a Python FastAPI application running on AWS ECS. I have my ECS Task Definition set up so that the grafana/fluent-bit-plugin-loki
container image is used per Grafana’s documentation (1). My logs are getting into my cloud Grafana instance, but they’re all appearing as “logs” instead of “info” or “error”.
My question is, How do I get these logs to show up as their intended log levels?
My Task Definition:
"containerDefinitions": [
{
"name": "log_router",
"image": "grafana/fluent-bit-plugin-loki",
"cpu": 0,
"memoryReservation": 50,
"portMappings": [],
"essential": true,
"environment": [],
"mountPoints": [],
"volumesFrom": [],
"user": "0",
"logConfiguration": {
"logDriver": "awslogs",
"options": {
"awslogs-create-group": "true",
"awslogs-group": "firelens-container",
"awslogs-region": "us-east-2",
"awslogs-stream-prefix": "firelens"
}
},
"systemControls": [],
"firelensConfiguration": {
"type": "fluentbit",
"options": {
"enable-ecs-log-metadata": "true"
}
}
},
{
"name": "[REDACTED]",
"image": "[REDACTED]",
"essential": true,
"logConfiguration": {
"logDriver": "awsfirelens",
"options": {
"LabelKeys": "container_name,ecs_task_definition,source,ecs_cluster",
"Labels": "{app="[REDACTED]"}",
"LineFormat": "key_value",
"Name": "grafana-loki",
"RemoveKeys": "container_id,ecs_task_arn",
"Url": "[REDACTED]"
}
}
}
]
1: https://grafana.com/docs/loki/latest/send-data/promtail/cloud/ecs/