Symptoms
- Dashboards or the data lake stop getting new data, but producers report no errors.
- Objects appear under prefixes such as
processing-failed/,opensearch-failed/orhttp-endpoint-failed/in the backup bucket. DataFreshnessfor the destination keeps climbing.- Producers log
ServiceUnavailableException, orPutRecordBatchreturns a non-zeroFailedPutCount.
Firehose failures happen in three places: ingest (the producer or source stream), transformation (Lambda), and delivery (the destination). Find out which one first.
STREAM=app-logs-to-opensearch
Step 1: check stream status and configuration
aws firehose describe-delivery-stream --delivery-stream-name $STREAM \
--query "DeliveryStreamDescription.{status:DeliveryStreamStatus,source:DeliveryStreamType,failure:FailureDescription,enc:DeliveryStreamEncryptionConfiguration.Status,version:VersionId}"
| Field | What to look for |
|---|---|
DeliveryStreamStatus | ACTIVE is normal. CREATING_FAILED or DELETING_FAILED show a FailureDescription |
DeliveryStreamEncryptionConfiguration.Status | ENABLING_FAILED or DISABLING_FAILED usually means a KMS key problem |
DeliveryStreamType | DirectPut (producers call Firehose) or KinesisStreamAsSource / MSKAsSource |
Dump the full destination block, with role ARN, buffering, retry and backup mode. You will need it later:
aws firehose describe-delivery-stream --delivery-stream-name $STREAM \
--query "DeliveryStreamDescription.Destinations[0]" > dest.json
Step 2: find the stage from metrics
Firehose publishes metrics every minute in the AWS/Firehose namespace with the DeliveryStreamName dimension.
| Stage | Metrics | Bad sign |
|---|---|---|
| Ingest (Direct PUT) | IncomingRecords, IncomingBytes, ThrottledRecords | ThrottledRecords above zero |
| Ingest (Kinesis source) | DataReadFromKinesisStream.Records, ThrottledGetRecords | Reads flat while the source stream grows |
| Transformation | ExecuteProcessing.Success, SucceedProcessing.Records | Success below 1 |
| Delivery to S3 | DeliveryToS3.Success, DeliveryToS3.DataFreshness | Success below 1, freshness growing |
| Other destinations | Per-destination Success and DataFreshness (for example DeliveryToAmazonOpenSearchService.DataFreshness) | Same pattern |
Metric names vary by destination. Open the stream's Monitoring tab or run aws cloudwatch list-metrics --namespace AWS/Firehose --dimensions Name=DeliveryStreamName,Value=$STREAM to see the exact names your stream emits.
aws cloudwatch get-metric-statistics --namespace AWS/Firehose \
--metric-name DeliveryToS3.DataFreshness \
--dimensions Name=DeliveryStreamName,Value=$STREAM \
--start-time $(date -u -d '-3 hours' +%FT%TZ) --end-time $(date -u +%FT%TZ) \
--period 300 --statistics Maximum
Step 3: read the error logs
With error logging enabled, Firehose writes to the log group /aws/kinesisfirehose/<stream>, in the log streams DestinationDelivery and BackupDelivery. If logging is off, turn it on first. Without it you are guessing.
aws logs filter-log-events --log-group-name /aws/kinesisfirehose/$STREAM \
--start-time $(( ($(date +%s) - 3600) * 1000 )) \
--query "events[].message" --output text | head -20
In Logs Insights, group the errors to see which ones dominate:
fields @timestamp, errorCode, errorMessage
| stats count(*) as n by errorCode, errorMessage
| sort n desc
| limit 20
Step 4: fix by destination
S3
| Error | Cause | Fix |
|---|---|---|
| Access denied to the bucket | Firehose role lacks s3:PutObject, or the bucket policy denies it | Add the permission. Check bucket policy conditions such as aws:SourceVpce or required encryption headers |
| KMS access denied | Role can't use the bucket's KMS key | Grant kms:GenerateDataKey and kms:Decrypt on the key, and allow the role in the key policy |
| Bucket not found or wrong region | Bucket deleted or recreated | Point the destination at the right bucket |
Firehose retries S3 delivery for up to 24 hours. After that, the data is gone. Alarm on DeliveryToS3.DataFreshness well before then.
OpenSearch Service
| Error | Cause | Fix |
|---|---|---|
| 403 from the domain | Fine-grained access control doesn't map the Firehose role | Map the role ARN to a backend role with write permission on the index pattern |
cluster_block_exception | Index read-only because the disk watermark was exceeded | Free or add storage, then clear the block |
mapper_parsing_exception | Field type conflicts with the mapping | Fix the producer or the mapping. Only these documents fail; the rest are indexed |
| Timeouts or 429 | Cluster overloaded | Scale the domain, reduce shard count per index, raise the buffer size |
Firehose retries for the configured retry duration (0–7200 seconds), then writes the failed documents to the S3 backup bucket. Per-document mapping errors go straight to the backup bucket.
HTTP endpoint and Splunk
- The endpoint must answer within the timeout with a 200 and a response body that matches the Firehose HTTP delivery spec, including the request ID it received. A 200 with the wrong body counts as a failure.
- For Splunk, check HEC token validity, indexer acknowledgement and the HEC endpoint type (raw or event) against the record format.
- Look for TLS errors in the logs. The endpoint needs a certificate from a trusted public CA.
Lambda transformation
Each returned record must include the original recordId, a result of Ok, Dropped or ProcessingFailed, and base64 data. Lambda errors, timeouts or a malformed response send the batch to processing-failed/ after retries.
aws logs tail /aws/lambda/firehose-transform --since 1h --filter-pattern "?ERROR ?Task ?timed"
Warning
A transformation that returns fewer records than it received, or changes the
recordId, makes Firehose treat the missing records as failed. Always return one output record for each input record.
Step 5: fix producer throttling
PutRecordBatch is not all-or-nothing. A call can succeed with some records rejected. The usual silent data loss is a producer that ignores FailedPutCount.
import boto3, time
fh = boto3.client("firehose")
def put_all(stream, records, max_attempts=8):
pending = [{"Data": r} for r in records]
for attempt in range(max_attempts):
resp = fh.put_record_batch(DeliveryStreamName=stream, Records=pending)
if resp["FailedPutCount"] == 0:
return
pending = [rec for rec, res in zip(pending, resp["RequestResponses"]) if "ErrorCode" in res]
time.sleep(min(2 ** attempt * 0.1, 5))
raise RuntimeError(f"{len(pending)} records still failing after {max_attempts} attempts")
If ThrottledRecords stays above zero, compare IncomingBytes and IncomingRecords with the stream's BytesPerSecondLimit and RecordsPerSecondLimit metrics. Direct PUT quotas depend on the region. Check the current limits and request an increase through Service Quotas, or shard producers across streams.
Step 6: replay failed records
Failed-record files in the backup bucket are JSON lines. Each line includes the error code, error message, attempt count and the original payload, base64 encoded in rawData. Fix the root cause first, then replay:
import base64, json, boto3
s3 = boto3.client("s3")
BUCKET, PREFIX, STREAM = "fh-backup-bucket", "opensearch-failed/2026/11/14/", "app-logs-to-opensearch"
paginator = s3.get_paginator("list_objects_v2")
for page in paginator.paginate(Bucket=BUCKET, Prefix=PREFIX):
for obj in page.get("Contents", []):
body = s3.get_object(Bucket=BUCKET, Key=obj["Key"])["Body"].read().decode()
records = [base64.b64decode(json.loads(l)["rawData"]) for l in body.splitlines() if l.strip()]
for i in range(0, len(records), 500):
put_all(STREAM, records[i:i + 500]) # from step 5
print("replayed", obj["Key"], len(records))
Caution
Replay is at-least-once. Delivery can partly succeed before a failure, so some replayed records may already be in the destination. Use a deterministic document ID in OpenSearch, or deduplicate downstream, before you replay large volumes. Move replayed files to a
replayed/prefix so a second run doesn't send them again.
Changing the destination safely
Updates need the current version ID and destination ID, which stops concurrent edits from overwriting each other:
VER=$(aws firehose describe-delivery-stream --delivery-stream-name $STREAM --query "DeliveryStreamDescription.VersionId" --output text)
DEST=$(aws firehose describe-delivery-stream --delivery-stream-name $STREAM --query "DeliveryStreamDescription.Destinations[0].DestinationId" --output text)
aws firehose update-destination --delivery-stream-name $STREAM \
--current-delivery-stream-version-id $VER --destination-id $DEST \
--amazon-open-search-service-destination-update '{"RetryOptions":{"DurationInSeconds":3600}}'
Prevent it next time
- Turn on error logging and S3 backup (failed data at minimum) for every stream.
- Alarm on destination
DataFreshnessabove twice the buffer interval, onSuccessbelow 1, and onThrottledRecordsabove zero. - Alarm on object count under the failed prefixes in the backup bucket, for example with an S3 event notification or a daily inventory check.
- Make producers check
FailedPutCount, and test that path with a throttling fault injection. - Keep OpenSearch disk watermarks and index mappings under change control. Most OpenSearch delivery incidents start there.
Get the weekly HubDatAI email
One email a week with everything new: posts, learning sessions and videos. Free, no spam, unsubscribe in one click. What you get