Skip to main content

Log drains

Plus

Log drains are available only to stores on a Shopify Plus plan.

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.


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.

Note

If the log drain provider experiences an outage, then Shopify isn't responsible for any failed log deliveries.


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:

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.

{
hostname: "example.com",
shop_id: "123456",
deployment_id: "abc8221",
storefront_id: "11111",
timestamp: "2023-03-30T10:00:00.000Z",
request_id: "abc4-3123fe-rg",
path: "/url_path",
idx: 0,
type: "request",
code: 200,
method: "GET",
url: "example.com/url_path",
user_agent: "Mozilla/5.0"
}
FieldDescription
hostnameThe domain name of the URL.
shop_idThe ID of the store.
storefront_idThe ID of the Hydrogen storefront. This is different from the shop_id because you can have multiple Hydrogen storefronts under a single store.
deployment_idThe ID of the storefront's deployment.
timestampThe time of the event.
request_idA unique ID of a request. This can be used to identify all request, runtime, or exception logs generated by a single request.
pathThe path component of the URL.
idxA counter that represents the order of events within a single request. The idx value will always be 0 for request type logs.
typeThe type of the log. Set to request for request logs. Possible values: request, runtime, exception.
codeThe HTTP response status code.
methodThe HTTP request method.
urlThe full request URL.
user_agentThe user agent provided in the request headers.

Runtime logs are usage logs that are typically sent to the console using console.log, console.warn or console.error.

{
hostname: "example.com",
shop_id: "123456",
deployment_id: "abc8221",
storefront_id: "11111",
timestamp: "2023-03-30T10:00:00.000Z",
request_id: "abc4-3123fe-rg",
path: "/url_path",
idx: 1,
type: "runtime",
level: "info",
message: "this is log message"
}
FieldDescription
hostnameThe domain name of the URL.
shop_idThe ID of the store.
storefront_idThe ID of the Hydrogen storefront. This is different from the shop_id because you can have multiple Hydrogen storefronts under a single store.
deployment_idThe ID of the storefront's deployment.
timestampThe time of the event.
request_idA unique ID of a request.
pathThe path component of the URL.
idxA 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.
typeThe type of log. Set to runtime for runtime or application logs. Possible values: request, runtime, exception.
levelThe log level. Possible values: info, debug, warn.
messageThe content of a logged message.

Exception logs are generated by uncaught exceptions in your Hydrogen storefront.

{
hostname: "example.com",
shop_id: "123456",
deployment_id: "abc8221",
storefront_id: "11111",
timestamp: "2023-03-30T10:00:00.000Z",
request_id: "abc4-3123fe-rg",
path: "/url_path",
idx: 2,
type: "exception",
name: "StandardError",
message: "Error when assigning value to a variable"
}
FieldDescription
hostnameThe domain name of the URL.
shop_idThe ID of the store.
storefront_idThe ID of the Hydrogen storefront. This is different from the shop_id because you can have multiple Hydrogen storefronts under a single store.
deployment_idThe ID of the storefront's deployment.
timestampThe time of the event.
request_idA unique ID of a request.
pathThe path component of the URL.
idxA 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.
typeThe type of the log. Set to exception for exception logs. Possible values: request, runtime, exception.
nameThe name of the error.
messageThe content of the error message.

Before you connect a log drain you need to be signed up with one of the following supported providers:

ProviderDocumentationCustom fields
DatadogDatadog docs
New RelicNew Relic docs
Splunk EnterpriseVector docs and Splunk Enterprise docs
  • The default token for the Splunk HTTP Event Collector.
  • The base URL of your Splunk Enterprise instance, including "https://".
  • The name of the log field to be used as the hostname sent to Splunk Enterprise.
  • The name of the Splunk index to send the events to. If not specified, then the default index is used.

Anchor to Connecting a log drainConnecting a log drain

To connect a log drain, complete the following steps:

  1. From your Shopify admin, under Sales channels, click Hydrogen.

  2. From the Hydrogen storefront page, click Storefront settings.

  3. On the Storefront settings page, click Integrations.

  4. On the Integrations settings page, click Connect a log drain.

  5. Select your log drain provider.

  6. Fill out the required fields for your provider.

  7. 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.


Was this page helpful?