You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am encountering an issue where logs ingested using Fluent Bit are not being tailed correctly in Loki 3.x versions. Logs seem to be dropped or are missing when tailing logs using the gRPC client or log-cli. This issue does not occur in Loki 2.9.10, where all logs are tailed correctly without any missing entries. (even with the --delay-for arg set)
To Reproduce
Steps to reproduce the behavior:
Started Loki with versions 3.x (where the issue is present).
Fluent Bit (v3.1.1) is reading Docker logs and sending them to Loki.
Tail logs using one of the following methods:
• gRPC client (custom implementation).
• Loki CLI with the following query:
Expected behavior
All logs ingested into Loki should appear in the tail stream in order and without any dropped or missing entries, even during high log throughput.
Environment:
• Loki Version: 3.x (issue present); 2.9.10 (working as expected)
• Fluent Bit Version: v3.1.1
• Infrastructure: Docker
• Deployment tool: Docker containers (both Fluent Bit and Loki deployed as containers)
• Log Source: Docker logs from a custom mock-service Python application
• Fluent Bit Configuration (fluent-bit-config.yaml):
fromtypingimportAnyimportdatetimeimportuuidfromfastapiimportFastAPIimportstructlogimportuvicornAPP_NAME="mock-service"logger: Any=structlog.get_logger()
app: FastAPI=FastAPI(title="Mock Service", description="Mock Service", version="0.1.0")
classCustomPrintLogger:
defmsg(self, message: Any) ->None:
print(message)
logger=structlog.wrap_logger(
CustomPrintLogger(),
wrapper_class=structlog.BoundLogger,
processors=[structlog.processors.JSONRenderer()],
)
@app.get("/levels")deflevels() ->dict[str, Any]:
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="fatal", appName=APP_NAME, message="mock message", host="mock-host",
compName="mock-component")
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="critical", appName=APP_NAME, message="mock message", host="mock-host",
compName="mock-component")
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="error", appName=APP_NAME, message="mock message", host="mock-host",
compName="mock-component")
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="warn", appName=APP_NAME, message="mock message", host="mock-host",
compName="mock-component")
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="warning", appName=APP_NAME, message="mock message", host="mock-host",
compName="mock-component")
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="info", appName=APP_NAME, message="mock message", host="mock-host",
compName="mock-component")
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="debug", appName=APP_NAME, message="mock message", host="mock-host",
compName="mock-component")
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="trace", appName=APP_NAME, message="mock message", host="mock-host",
compName="mock-component")
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="unknown", appName=APP_NAME, message="mock message", host="mock-host",
compName="mock-component")
logger.msg("mock-event", time=str(datetime.datetime.now(datetime.timezone.utc)),
level="random", appName=APP_NAME, message=f"mock message {uuid.uuid4()}",
host="mock-host", compName="mock-component")
print("FATAL: This is an example of unstructured log line")
print("CRITICAL: This is an example of unstructured log line")
print("ERROR: This is an example of unstructured log line")
print("WARN: This is an example of unstructured log line")
print("WARNING: This is an example of unstructured log line")
print("INFO: This is an example of unstructured log line")
print("DEBUG: This is an example of unstructured log line")
print("TRACE: This is an example of unstructured log line")
print("UNKNOWN: This is an example of unstructured log line")
print(f"RANDOM: This is an example of unstructured log line {uuid.uuid4()}")
return {}
if__name__=="__main__":
structlog.configure(
processors=[
structlog.stdlib.filter_by_level,
structlog.processors.TimeStamper(fmt="iso", key="time"),
structlog.processors.JSONRenderer(),
],
context_class=dict,
logger_factory=structlog.stdlib.LoggerFactory(),
)
uvicorn.run("main:app", host="0.0.0.0", port=9012, reload=True, log_level="critical")
docker run --name mock-service -p 9012:9012 mock-custom:latest
docker build -t mock-custom:latest -f fake.dockerfile .
curl 127.0.0.1:9012/levels # to generate logs
Screenshots, Promtail config, or terminal output
Current result
Expected result
The text was updated successfully, but these errors were encountered:
Describe the bug
I am encountering an issue where logs ingested using Fluent Bit are not being tailed correctly in Loki 3.x versions. Logs seem to be dropped or are missing when tailing logs using the gRPC client or log-cli. This issue does not occur in Loki 2.9.10, where all logs are tailed correctly without any missing entries. (even with the --delay-for arg set)
To Reproduce
Steps to reproduce the behavior:
• gRPC client (custom implementation).
• Loki CLI with the following query:
logcli query --tail '{job="logs", appName="mock-service"}' --addr=http://localhost:3200
Expected behavior
All logs ingested into Loki should appear in the tail stream in order and without any dropped or missing entries, even during high log throughput.
Environment:
• Loki Version: 3.x (issue present); 2.9.10 (working as expected)
• Fluent Bit Version: v3.1.1
• Infrastructure: Docker
• Deployment tool: Docker containers (both Fluent Bit and Loki deployed as containers)
• Log Source: Docker logs from a custom mock-service Python application
• Fluent Bit Configuration (fluent-bit-config.yaml):
• Fluent Bit Dockerfile:
• Fluent Bit (parsers.ini):
docker network create loki-network docker build -t fluent-bit-custom:latest -f fake.fluentbit.dockerfile . docker run -d --name fluent-bit-custom --network loki-network -v /var/lib/docker/containers:/var/lib/docker/containers fluent-bit-custom:latest
• Fluent Bit (docker_filter.lua):
• Loki Configuration in (config/loki-config.yaml):
docker run --name loki --network loki-network -d -v $(pwd)/config:/mnt/config -p 3200:3200 grafana/loki:3.0.0 -config.file=/mnt/config/loki-config.yaml
Mock Service Dockerfile (fake.dockerfile):
Mock Service Code (main.py):
Screenshots, Promtail config, or terminal output
Current result
Expected result
The text was updated successfully, but these errors were encountered: