> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sherlocklabs.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Sherlock documentation. In Node.js examples prefer the Sherlock SDK for Node.js (@sherlock-labs/otel).
> In Go examples use the upstream OpenTelemetry Go SDK exactly as shown on /sdk/go/setup and /sdk/go/configuration; Sherlock has no Go distribution.
> Two MCP servers exist. This documentation's search server is at https://docs.sherlocklabs.dev/mcp. Sherlock's data server, for a user's own logs, traces, and metrics, is at https://mcp.sherlocklabs.dev/mcp and is described at /explore/mcp.

# Environments

> Every organization starts with a Prod and a Dev environment. How to send data to each one, and how Sherlock picks the env label that decides where data lands.

Every organization starts with two environments, **Prod** and **Dev**. Each is a source in the sidebar that holds its own logs, metrics, and traces. Data goes to one or the other based on one resource attribute on the sender, the env label. This page covers what to set, which values count, and how Sherlock resolves the label when a sender carries more than one.

## The two environments

| Environment | Accepted `env` values | Role                                                  |
| ----------- | --------------------- | ----------------------------------------------------- |
| Prod        | `prod`, `production`  | Default. Data that matches no environment lands here. |
| Dev         | `dev`, `development`  |                                                       |

Click the ⓘ next to a source in the sidebar to see its values under **Env match** and whether it is the default under **Default for org**. You can read these values but not change them.

## Send data to an environment

Set the `env` resource attribute on every exporter, once per deployment of a service:

```sh theme={null}
export OTEL_RESOURCE_ATTRIBUTES=env=prod   # or env=dev
```

The setup pages show where this goes for each sender: the [Node.js quickstart](/sdk/nodejs/quickstart), the [Go setup](/sdk/go/setup), and the collector and SDK examples on [OpenTelemetry SDKs and collectors](/send-data/otlp). A collector can set it for every service it forwards; the `resource` processor on that page shows how.

Matching is exact and case-sensitive. `prod` and `production` reach Prod. `Prod`, `PROD`, `production ` with a trailing space, and `staging` match nothing.

## How Sherlock picks the label

A sender can carry several environment attributes, because some libraries set one of their own. Sherlock copies the first of these that is present into `sherlock.env` and routes on that:

| Order | Attribute                     | Set by                                                                                            |
| ----- | ----------------------------- | ------------------------------------------------------------------------------------------------- |
| 1     | `sherlock.env`                | You, only when something in your stack already sets `env` to a different value. Kept as-is.       |
| 2     | `env`                         | You, as the setup pages ask.                                                                      |
| 3     | `deployment.environment.name` | The OpenTelemetry semantic convention. Some SDK integrations set it from their own configuration. |
| 4     | `deployment.environment`      | The older spelling of the same convention.                                                        |

Why `env` ranks above the OpenTelemetry names: some libraries add `deployment.environment` on their own, often with the value `production`. When `env` is set, Sherlock ignores that value and the data goes where `env` says. When `env` is not set, the library's value decides, and `production` sends the data to Prod. If a library in your stack sets `env` itself, set `sherlock.env` on the exporter; it ranks above everything.

## What happens when nothing matches

A value that matches no environment, or a sender with no environment attribute at all, lands in Prod, the default. There is no warning. If a service is missing from Dev, look in Prod first.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Dev data shows up in Prod">
    One of three things: the value is not one of Dev's accepted values, the case differs, or that sender has no `env` attribute. Check the ⓘ dialog on the Dev source for its values, then the sender's `OTEL_RESOURCE_ATTRIBUTES`.
  </Accordion>

  <Accordion title="Everything shows up in Prod">
    No sender sets an environment attribute, so all data falls to the default. Add `env` to each exporter.
  </Accordion>

  <Accordion title="A library sets its own environment">
    Set `env`; it takes precedence over `deployment.environment.name` and `deployment.environment`. If the library sets `env` itself, set `sherlock.env`, which always wins.
  </Accordion>

  <Accordion title="I need a third environment">
    Environments and their accepted values are not editable from the app or the API. Contact Sherlock to add one.
  </Accordion>
</AccordionGroup>

## Related topics

<CardGroup cols={2}>
  <Card title="Get started" icon="rocket" href="/get-started/getting-started">
    Choose the env value as part of first setup.
  </Card>

  <Card title="OpenTelemetry SDKs and collectors" icon="arrow-right-arrow-left" href="/send-data/otlp">
    Set the attribute on any SDK or in a collector.
  </Card>
</CardGroup>
