使用 Kinesis 数据消防水管监控CloudWatch日志 - Amazon Kinesis Data Firehose
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

使用 Kinesis 数据消防水管监控CloudWatch日志

Kinesis Data Firehose 已与亚马逊CloudWatch日志,以便当用于数据转换或数据传输的 Lambda 调用失败时,您可以查看特定的错误日志。在创建交付流时,您可以启用 Kinesis Data Firehose 错误日志记录。

如果您在 Kinesis Data Firehose 控制台中启用 Kinesis Data Firehose 错误日志,则会代表您为传输流创建日志组和相应的日志流。日志组名称的格式为/aws/kinesisfirehose/delivery-stream-name,其中delivery-stream-name是相应传输流的名称。DestinationDelivery是创建并用于记录与传送到主要目的地相关的任何错误的日志流。另一个日志流名为BackupDelivery仅在为目标启用了 S3 备份时才会创建。这个BackupDelivery日志流用于记录与传送到 S3 备份相关的任何错误。

例如,如果您创建传输流”MyStream“以亚马逊 Redshift 为目标并启用 Kinesis Data Firehose 错误日志,以下内容是代表您创建的:名为的日志组aws/kinesisfirehose/MyStream还有两个名为的日志流DestinationDeliveryBackupDelivery。在这个例子中,DestinationDelivery将用于记录与传送到 Amazon Redshift 目的地以及与中间 S3 目的地相关的任何错误。BackupDelivery,如果启用了 S3 备份,则将用于记录与传送到 S3 备份存储桶相关的任何错误。

你可以通过启用 Kinesis Data Firehose 错误日志Amazon CLI、API 或Amazon CloudFormation使用CloudWatchLoggingOptions配置。为此,请提前创建日志组和日志流。我们建议仅为 Kinesis Data Firehose 错误日志保留该日志组和日志流。还要确保关联的 IAM 策略有"logs:putLogEvents"许可。有关更多信息,请参阅使用亚马逊 Kinesis 数据消防管控制访问权限

请注意,Kinesis Data Firehose 不保证所有传送错误日志都会发送到CloudWatch日志。在传输失败率很高的情况下,Kinesis Data Firehose 会先采样传输错误日志,然后再将其发送到CloudWatch日志。

发送到的错误日志收取象征性费用CloudWatch日志。有关更多信息,请参阅 Amazon CloudWatch 定价

数据传输错误

以下是每个 Kinesis Data Firehose 目的地的数据传输错误代码和消息列表。每个错误消息还描述了修复问题所应采取的适当操作。

亚马逊 S3 数据传输错误

Kinesis Data Firehose 可以将以下与亚马逊 S3 相关的错误发送至CloudWatch日志。

错误代码 错误消息和信息
S3.KMS.NotFoundException

"The provided Amazon KMS key was not found。If you are using what you believe to be a valid Amazon KMS key with the correct role, check if there is a problem with the account to which the Amazon KMS key is attached."

S3.KMS.RequestLimitExceeded

"The KMS request per second limit was exceeded while attempting to encrypt S3 objects。Increase the request per second limit."

有关更多信息,请参阅《Amazon Key Management Service 开发人员指南》中的限制

S3.AccessDenied "Access was denied。确保所提供的 IAM 角色的信任策略允许 Kinesis Data Firehose 代入该角色,并且访问策略允许访问 S3 存储桶。”
S3.AccountProblem “你有问题Amazon阻止操作成功完成的帐户。联系我们Amazon支持。”
S3.AllAccessDisabled "Access to the account provided has been disabled。联系我们Amazon支持。”
S3.InvalidPayer "Access to the account provided has been disabled。联系我们Amazon支持。”
S3.NotSignedUp “该账户未注册 Amazon S3。Sign the account up or use a different account."
S3.NoSuchBucket "The specified bucket does not exist。Create the bucket or use a different bucket that does exist."
S3.MethodNotAllowed "The specified method is not allowed against this resource。修改存储桶的策略以允许正确的 Amazon S3 操作权限。”
InternalError "An internal error occurred while attempting to deliver data。将重试交付;如果错误仍然存在,则会将其报告给Amazon用于分辨率。”

亚马逊 Redshift 数据传输错误

Kinesis Data Firehose 可以将以下与亚马逊 Redshift 相关的错误发送至CloudWatch日志。

错误代码 错误消息和信息
Redshift.TableNotFound

"The table to which to load data was not found。Ensure that the specified table exists."

在 Amazon Redshift 中找不到应从 S3 复制数据的目标表。请注意,如果亚马逊 Redshift 表不存在,Kinesis Data Firehose 不会创建该表。

Redshift.SyntaxError "The COPY command contains a syntax error。Retry the command."
Redshift.AuthenticationFailed "The provided user name and password failed authentication。Provide a valid user name and password."
Redshift.AccessDenied "Access was denied。确保所提供的 IAM 角色的信任策略允许 Kinesis Data Firehose 担任该角色。”
Redshift.S3BucketAccessDenied "The COPY command was unable to access the S3 bucket。确保所提供的 IAM 角色的访问策略允许访问 S3 存储桶。”
Redshift.DataLoadFailed "Loading data into the table failed。Check STL_LOAD_ERRORS system table for details."
Redshift.ColumnNotFound "A column in the COPY command does not exist in the table。Specify a valid column name."
Redshift.DatabaseNotFound “找不到亚马逊 Redshift 目标配置或 JDBC URL 中指定的数据库。Specify a valid database name."
Redshift.IncorrectCopyOptions

"Conflicting or redundant COPY options were provided。Some options are not compatible in certain combinations。Check the COPY command reference for more info."

有关更多信息,请参阅亚马逊 Redshift 复制命令亚马逊 Redshift 数据库开发者指南

Redshift.MissingColumn "There is a column defined in the table schema as NOT NULL without a DEFAULT value and not included in the column list。排除此列,确保加载的数据始终为该列提供值,或者向该表的 Amazon Redshift 架构添加默认值。”
Redshift.ConnectionFailed “与指定亚马逊 Redshift 集群的连接失败。确保安全设置允许 Kinesis Data Firehose 连接,在亚马逊 Redshift 目标配置或 JDBC URL 中指定的集群或数据库正确无误,并且集群可用。”
Redshift.ColumnMismatch "The number of jsonpaths in the COPY command and the number of columns in the destination table should match。Retry the command."
Redshift.IncorrectOrMissingRegion “亚马逊 Redshift 试图使用错误的区域终端节点来访问 S3 存储桶。要么在 COPY 命令选项中指定正确的区域值,要么确保 S3 存储桶与 Amazon Redshift 数据库位于同一区域。”
Redshift.IncorrectJsonPathsFile "The provided jsonpaths file is not in a supported JSON format。Retry the command."
Redshift.MissingS3File “亚马逊 Redshift 需要的一个或多个 S3 文件已从 S3 存储桶中删除。Check the S3 bucket policies to remove any automatic deletion of S3 files."
Redshift.InsufficientPrivilege "The user does not have permissions to load data into the table。检查亚马逊 Redshift 用户权限以获取插入权限。”
Redshift.ReadOnlyCluster "The query cannot be executed because the system is in resize mode。Try the query again later."
Redshift.DiskFull "Data could not be loaded because the disk is full。增加 Amazon Redshift 集群的容量或删除未使用的数据以释放磁盘空间。”
InternalError "An internal error occurred while attempting to deliver data。将重试交付;如果错误仍然存在,则会将其报告给Amazon用于分辨率。”

Splunk 数据传输错误

Kinesis Data Firehose 可以将以下与 Splunk 相关的错误发送到CloudWatch日志。

错误代码 错误消息和信息
Splunk.ProxyWithoutStickySessions

“如果你在 Kinesis Data Firehose 和 HEC 节点之间有代理(ELB 或其他代理),则必须启用粘性会话才能支持 HEC ACK。”

Splunk.DisabledToken "The HEC token is disabled。Enable the token to allow data delivery to Splunk."
Splunk.InvalidToken "The HEC token is invalid。使用有效的 HEC 代币更新 Kinesis Data Firehose。”
Splunk.InvalidDataFormat "The data is not formatted correctly。To see how to properly format data for Raw or Event HEC endpoints, see Splunk Event Data."
Splunk.InvalidIndex "The HEC token or input is configured with an invalid index。Check your index configuration and try again."
Splunk.ServerError “由于来自 HEC 节点的服务器错误,向 Splunk 传输数据失败。如果您的 Kinesis Data Firehose 中的重试持续时间大于 0,Kinesis Data Firehose 将重试发送数据。如果所有重试都失败,Kinesis Data Firehose 会将数据备份到亚马逊 S3。”
Splunk.DisabledAck "Indexer acknowledgement is disabled for the HEC token。Enable indexer acknowledgement and try again。For more info, see Enable indexer acknowledgement."
Splunk.AckTimeout "Did not receive an acknowledgement from HEC before the HEC acknowledgement timeout expired。尽管确认超时,但数据可能已在 Splunk 中成功建立索引。Kinesis Data Firehose 在确认超时已过期的亚马逊 S3 数据中进行备份。”
Splunk.MaxRetriesFailed

"Failed to deliver data to Splunk or to receive acknowledgment。Check your HEC health and try again."

Splunk.ConnectionTimeout "The connection to Splunk timed out。这可能是暂时性错误,请求将被重试。如果所有重试都失败,Kinesis Data Firehose 会将数据备份到亚马逊 S3。”
Splunk.InvalidEndpoint "Could not connect to the HEC endpoint。确保 HEC 端点 URL 有效且可从 Kinesis Data Firehose 访问。”
Splunk.ConnectionClosed "Unable to send data to Splunk due to a connection failure。This might be a transient error。延长 Kinesis Data Firehose 配置中的重试持续时间可能会防止此类暂时性故障。”
Splunk.SSLUnverified "Could not connect to the HEC endpoint。主机与对等项提供的证书不匹配。请确保证书和主机是有效的。
Splunk.SSLHandshake "Could not connect to the HEC endpoint。请确保证书和主机是有效的。

HTTPS 端点数据传输错误

Kinesis Data Firehose 可以将以下与 HTTP 端点相关的错误发送到CloudWatch日志。如果这些错误都与你遇到的问题不匹配,则默认错误如下:“尝试传送数据时出现内部错误。将重试交付;如果错误仍然存在,则会将其报告给Amazon用于分辨率。”

错误代码 错误消息和信息
HttpEndpoint.RequestTimeout

交付在收到回复之前已超时,将重试。如果此错误仍然存在,请联系Amazon消防水龙头服务小组。

HttpEndpoint.ResponseTooLarge “从端点收到的响应太大。请联系终端的所有者以解决此问题。”
HttpEndpoint.InvalidResponseFromDestination “从指定端点收到的响应无效。请联系端点的所有者以解决问题。”
HttpEndpoint.DestinationException “从终端目的地收到以下响应。”
HttpEndpoint.ConnectionFailed “无法连接到目标端点。请联系终端的所有者以解决此问题。”
HttpEndpoint.ConnectionReset “无法保持与端点的连接。请联系终端的所有者以解决此问题。”
HttpEndpoint.ConnectionReset “与端点保持连接时出现问题。请联系终端的所有者。”

亚马逊OpenSearch服务数据传输错误

对于OpenSearch服务目标,Kinesis Data Firehose 将错误发送至CloudWatch由返回的日志OpenSearch服务。

除了可能返回的错误外OpenSearch集群,你可能会遇到以下两个错误:

  • 尝试将数据传送到目的地时发生身份验证/授权错误OpenSearch服务集群。这可能是由于任何权限问题和/或间歇性发生在你的 Kinesis Data Firehose 目标时发生的OpenSearch服务域配置已修改。请检查集群策略和角色权限。

  • 数据无法传送到目的地OpenSearch由于身份验证/授权失败而导致的服务集群。这可能是由于任何权限问题和/或间歇性发生在你的 Kinesis Data Firehose 目标时发生的OpenSearch服务域配置已修改。请检查集群策略和角色权限。

Lambda 调用错误

Kinesis Data Firehose 可以将以下 Lambda 调用错误发送到CloudWatch日志。

错误代码 错误消息和信息
Lambda.AssumeRoleAccessDenied

"Access was denied。确保所提供的 IAM 角色的信任策略允许 Kinesis Data Firehose 担任该角色。”

Lambda.InvokeAccessDenied

"Access was denied。确保访问策略允许访问 Lambda 函数。”

Lambda.JsonProcessingException

“解析 Lambda 函数返回的记录时出错。确保返回的记录符合 Kinesis Data Firehose 要求的状态模型。”

有关更多信息,请参阅数据转换和状态模型

Lambda.InvokeLimitExceeded

“已超过 Lambda 并发执行限制。Increase the concurrent execution limit."

有关更多信息,请参见AmazonLambda 极限Amazon Lambda开发者指南

Lambda.DuplicatedRecordId

"Multiple records were returned with the same record ID。确保 Lambda 函数返回每条记录的唯一记录 ID。”

有关更多信息,请参阅数据转换和状态模型

Lambda.MissingRecordId

"One or more record IDs were not returned。确保 Lambda 函数返回所有收到的记录 ID。”

有关更多信息,请参阅数据转换和状态模型

Lambda.ResourceNotFound

“指定的 Lambda 函数不存在。Use a different function that does exist."

Lambda.InvalidSubnetIDException

“Lambda 函数 VPC 配置中指定的子网 ID 无效。Ensure that the subnet ID is valid."

Lambda.InvalidSecurityGroupIDException

“Lambda 函数 VPC 配置中指定的安全组 ID 无效。Ensure that the security group ID is valid."

Lambda.SubnetIPAddressLimitReachedException

“Amazon Lambda无法为 Lambda 函数设置 VPC 访问权限,因为一个或多个已配置的子网没有可用的 IP 地址。Increase the IP address limit."

有关更多信息,请参见亚马逊 VPC 限制-VPC 和子网亚马逊 VPC 用户指南

Lambda.ENILimitReachedException

“Amazon Lambda无法在 VPC 中创建作为 Lambda 函数配置的一部分指定的弹性网络接口 (ENI),因为已达到网络接口的限制。Increase the network interface limit."

有关更多信息,请参见亚马逊 VPC 限制-网络接口亚马逊 VPC 用户指南

Lambda。FunctionTimedOut

Lambda 函数调用超时。增加 Lambda 函数中的超时设置。有关更多信息,请参见配置函数超时

Lambda。FunctionError

这可能是由于以下任何错误造成的:

  • 输出结构无效。检查您的函数并确保输出采用所需的格式。此外,请确保已处理的记录包含的有效结果状态为DroppedOk,或ProcessingFailed

  • Lambda 函数已成功调用,但它返回了错误结果。

  • Lambda 无法解密环境变量,因为对 KMS 密钥的访问已被拒绝。检查该函数的 KMS 密钥设置以及密钥策略。有关更多信息,请参见排除密钥访问故障

Lambda。FunctionRequestTimedOut

Kinesis Data Firehose 在调用 Lambda 时遇到了请求未完成之前请求超时配置错误。重新访问 Lambda 代码以检查 Lambda 代码是否打算在配置的超时之后运行。如果是,请考虑调整 Lambda 配置设置,包括内存、超时。有关更多信息,请参见配置 Lambda 函数选项

Lambda。TargetServerFailedToRespond

Kinesis Data Firehose 遇到了错误。目标服务器在调用时未能响应错误AmazonLambda 服务。

Lambda。InvalidZipFileException

遇到了 Kinesis Data 消防队InvalidZipFileException调用 Lambda 函数时。检查您的 Lambda 函数配置设置和 Lambda 代码压缩文件。

Lambda。InternalServerError

“遇到了 Kinesis Data 消防队InternalServerError打电话时AmazonLambda 服务。Kinesis Data Firehose 将按固定次数重试发送数据。您可以使用来指定或覆盖重试选项CreateDeliveryStream要么UpdateDestinationAPI。如果错误仍然存在,请联系AmazonLambda 支持团队。

Lambda。ServiceUnavailable

遇到了 Kinesis Data 消防队ServiceUnavailableException打电话时AmazonLambda 服务。Kinesis Data Firehose 将按固定次数重试发送数据。您可以使用来指定或覆盖重试选项CreateDeliveryStream要么UpdateDestinationAPI。如果错误仍然存在,请联系AmazonLambda 支持。

Lambda。InvalidSecurityToken

由于安全令牌无效,无法调用 Lambda 函数。不支持跨分区 Lambda 调用。

Lambda。InvocationFailure

这可能是由于以下任何错误造成的:

  • Kinesis Data Firehose 在调用时遇到AmazonLambda。将重试该操作;如果错误仍然存在,将报告给Amazon用于分辨率。”

  • Kinesis 数据消防队遇到了 KMSInvalidStateException来自 Lambda。Lambda 无法解密环境变量,因为所用的 KMS 密钥处于无效的解密状态。检查 lambda 函数的 KMS 密钥。

  • Kinesis 数据消防队遇到了AmazonLambdaException来自 Lambda。Lambda 无法初始化提供的容器映像。验证图片。

  • Kinesis Data Firehose 在调用时遇到超时AmazonLambda。支持的最大函数超时为 5 分钟。有关更多信息,请参见数据转换执行持续时间

Lambda。JsonMappingException

解析 Lambda 函数返回的记录时出错。确保数据字段采用 base-64 编码。

正在访问CloudWatchKinesis 数据消防队的日志

你可以使用 Kinesis Data Firehose 控制台查看与 Kinesis Data Firehose 数据传输失败相关的错误日志,或者CloudWatch控制台。下面的过程介绍如何使用这两种方法访问错误日志。

使用 Kinesis Data Firehose 控制台访问错误日志
  1. 登录到 Amazon Web Services Management Console,然后通过以下网址打开 Kinesis 控制台:https://console.aws.amazon.com/kinesisvideo/home

  2. 在导航窗格中选择 Data Firehose (数据 Firehose)

  3. 在导航栏上,选择一个Amazon区域。

  4. 选择传输流名称,转到传输流详细信息页面。

  5. 选择 Error Log 查看与数据传输故障有关的错误日志的列表。

使用 CloudWatch 控制台访问错误日志
  1. 打开 CloudWatch 控制台 (https://console.aws.amazon.com/cloudwatch/)。

  2. 在导航栏中,选择一个区域。

  3. 在导航窗格中,选择日志

  4. 选择日志组和日志流,查看与数据传输故障有关的错误日志的列表。