The API Gateway documentation claims $context.requestTimeEpoch
is in millseconds (source). However, when logging this field to cloudwatch and pushing this property to EventBridge, the timestamp appears to be in seconds.
API gateway logging configuration contains "requestTimeEpoch": "$context.requestTimeEpoch"
Example logging event:
{ ...
"requestTime": "07/Feb/2024:18:44:06 +0000",
"requestTimeEpoch": "1707331446", # clearly in seconds
"httpMethod": "POST",
I'm also using the $context.requestTimeEpoch
property for an EventBridge integration for the Time
property. When looking at the events in cloudwatch, they are also in seconds:
{ ...
"account": "...",
"time": "2024-02-07T18:44:06Z", #no ms precision
"region": "us-east-2",
I tried to provide feedback to the support documentation and the response I got was:
The output of $context.requestTimeEpoch is in ms. It sounds like you actually have a technical support question.
It's hard to believe I'm doing something wrong here, unless both Cloudwatch and Eventbridge are cutting the precision of this property.
Is there any way to get millisecond precision from this property?