Log drains
Log drains enable merchants to send a copy of their logs to a supported destination, or sink, of their choice. Supported sinks include: Splunk Enterprise, Datadog, and New Relic.
Delivery guarantees
Anchor link to section titled "Delivery guarantees"In the event of a failed request, Shopify will retry a number of times over a set amount of time. However, Shopify doesn't provide any uptime or delivery guarantees on behalf of the sink provider.
The average log message is expected to be processed in a few seconds, with initial delivery to be attempted within five minutes. Different providers might take additional time to handle the ingestion of logs. Delivery and retries can be impacted by limitations and availability of the external provider in use. If the third-party provider can't receive or handle a request during the retry time frame, then the messages are dropped.
Different types of logs are sent through the log drains integration. Review the following log types so that you can effectively manage and analyze the data generated by your Hydrogen storefront:
Request logs
Anchor link to section titled "Request logs"A request log is a message generated by Shopify that provides general metadata around each request. This information is important for monitoring and troubleshooting issues related to your Hydrogen storefront's performance and user interactions.
Field | Description |
---|---|
hostname |
The domain name of the URL. |
shop_id |
The ID of the store. |
storefront_id |
The ID of the Hydrogen storefront. This is different from the shop_id because you can have multiple Hydrogen storefronts under a single store. |
deployment_id |
The ID of the storefront's deployment. |
timestamp |
The time of the event. |
request_id |
A unique ID of a request. This can be used to identify all request, runtime, or exception logs generated by a single request. |
path |
The path component of the URL. |
idx |
A counter that represents the order of events within a single request. The idx value will always be 0 for request type logs. |
type |
The type of the log. Set to request for request logs. Possible values: request , runtime , exception . |
code |
The HTTP response status code. |
method |
The HTTP request method. |
url |
The full request URL. |
user_agent |
The user agent provided in the request headers. |
Runtime logs
Anchor link to section titled "Runtime logs"Runtime logs are usage logs that are typically sent to the console using console.log
, console.warn
or console.error
.
Field | Description |
---|---|
hostname |
The domain name of the URL. |
shop_id |
The ID of the store. |
storefront_id |
The ID of the Hydrogen storefront. This is different from the shop_id because you can have multiple Hydrogen storefronts under a single store. |
deployment_id |
The ID of the storefront's deployment. |
timestamp |
The time of the event. |
request_id |
A unique ID of a request. |
path |
The path component of the URL. |
idx |
A counter that represents the order of events within a single request. This is useful if you have multiple log lines that occur at the same timestamp. |
type |
The type of log. Set to runtime for runtime or application logs. Possible values: request , runtime , exception . |
level |
The log level. Possible values: info , debug , warn . |
message |
The content of a logged message. |
Exception logs
Anchor link to section titled "Exception logs"Exception logs are generated by uncaught exceptions in your Hydrogen storefront.
Field | Description |
---|---|
hostname |
The domain name of the URL. |
shop_id |
The ID of the store. |
storefront_id |
The ID of the Hydrogen storefront. This is different from the shop_id because you can have multiple Hydrogen storefronts under a single store. |
deployment_id |
The ID of the storefront's deployment. |
timestamp |
The time of the event. |
request_id |
A unique ID of a request. |
path |
The path component of the URL. |
idx |
A counter that represents the order of events within a single request. This is useful if you have multiple log lines that occur at the same timestamp. |
type |
The type of the log. Set to exception for exception logs. Possible values: request , runtime , exception . |
name |
The name of the error. |
message |
The content of the error message. |
Log drain providers
Anchor link to section titled "Log drain providers"Before you connect a log drain you need to be signed up with one of the following supported providers:
Provider | Documentation | Custom fields |
---|---|---|
Datadog | Datadog docs |
|
New Relic | New Relic docs |
|
Splunk Enterprise | Vector docs and Splunk Enterprise docs |
|
Connecting a log drain
Anchor link to section titled "Connecting a log drain"To connect a log drain, complete the following steps:
From your Shopify admin, under Sales channels, click Hydrogen.
From the Hydrogen storefront page, click Storefront settings.
On the Storefront settings page, click Integrations.
On the Integrations settings page, click Connect a log drain.
Select your log drain provider.
Fill out the required fields for your provider.
Click Connect.
After you've created the connection, navigate to your sink to validate that your logs are successfully received. You need to make requests to your storefront application to view the logs. If you don't see logs after a few minutes, then check the status of your log drain connection or try sending logs again.