Component(s)
loki.write
What's wrong?
We are testing the Alloy - loki.write WAL feature to make sure we never lose logs if Loki is unavailable ( returns 5xx or 429 HTTP status codes ).
We have two loki.write components that are sending logs on different urls and both components have WAL configured.
loki.write 1 sends the logs to endpoint that always returns HTTP 200 , and loki.write 2 sends the logs to endpoint that always returns HTTP 429.
When we restart the alloy instance ( or when the reload endpoint is called ) alloys goes into draining mode and tries to send all the logs from the WAL.
Component loki.write 2 can not send the logs ( because it always gets the HTTP 429 ) but the marker for the WAL is incremented to the latest file, so when the alloy restarts the logs that could not be sent are lost because the WAL marker is at the latest position.
We would like to request the WAL marker to NOT be advanced if alloy gets retry-able HTTP code when doing the re-sending ( 429 / 5xx )
Steps to reproduce
-
Configure alloy to send logs for pod1 to endpoint1 ( this endpoint should return http 200 all the time ) and the logs for pod2 to endpoint2 ( this enpoint should return http 429 all the time ) and enable the WAL for both loki.write components ( see the configuration section )
-
Open a shell to the alloy pod and make sure that the WAL marker is on the same position for the endpoint2 writer.
-
Restart the pod and then open a shell again and check the WAL marker for the endpoint2 writer -> it will be on the latest position but the logs will be missing in Loki
System information
AWS EKS, AWS Linux - 64-bit Arm
Software version
Grafana Alloy v1.19.2
Configuration
loki.write "loki_write_success" {
endpoint {
url = "<endpoint_that_returns_200>"
bearer_token_file = "<path-to-bearer-token>"
batch_wait = "15s"
batch_size = "4MiB"
retry_on_http_429 = true
min_backoff_period = "10s"
max_backoff_period = "10m0s"
max_backoff_retries = 10000000
}
external_labels = {}
wal {
enabled = true
max_segment_age = "2h"
drain_timeout = "30s"
min_read_frequency = "250ms"
max_read_frequency = "1s"
}
}
loki.write "loki_write_failed" {
endpoint {
url = "<endpoint_that_returns_429>"
bearer_token_file = "<path-to-bearer-token>"
batch_wait = "15s"
batch_size = "4MiB"
retry_on_http_429 = true
min_backoff_period = "10s"
max_backoff_period = "10m0s"
max_backoff_retries = 10000000
}
external_labels = {}
wal {
enabled = true
max_segment_age = "2h"
drain_timeout = "30s"
min_read_frequency = "250ms"
max_read_frequency = "1s"
}
}
Logs
AI disclosure
Tip
React with 👍 if this issue is important to you.
Component(s)
loki.write
What's wrong?
We are testing the Alloy - loki.write WAL feature to make sure we never lose logs if Loki is unavailable ( returns 5xx or 429 HTTP status codes ).
We have two loki.write components that are sending logs on different urls and both components have WAL configured.
loki.write 1 sends the logs to endpoint that always returns HTTP 200 , and loki.write 2 sends the logs to endpoint that always returns HTTP 429.
When we restart the alloy instance ( or when the reload endpoint is called ) alloys goes into draining mode and tries to send all the logs from the WAL.
Component loki.write 2 can not send the logs ( because it always gets the HTTP 429 ) but the marker for the WAL is incremented to the latest file, so when the alloy restarts the logs that could not be sent are lost because the WAL marker is at the latest position.
We would like to request the WAL marker to NOT be advanced if alloy gets retry-able HTTP code when doing the re-sending ( 429 / 5xx )
Steps to reproduce
Configure alloy to send logs for pod1 to endpoint1 ( this endpoint should return http 200 all the time ) and the logs for pod2 to endpoint2 ( this enpoint should return http 429 all the time ) and enable the WAL for both loki.write components ( see the configuration section )
Open a shell to the alloy pod and make sure that the WAL marker is on the same position for the endpoint2 writer.
Restart the pod and then open a shell again and check the WAL marker for the endpoint2 writer -> it will be on the latest position but the logs will be missing in Loki
System information
AWS EKS, AWS Linux - 64-bit Arm
Software version
Grafana Alloy v1.19.2
Configuration
Logs
AI disclosure
Tip
React with 👍 if this issue is important to you.