﻿---
title: Get started with Elastic nightshift
description: Enable Elastic nightshift, connect your data and code, run your first investigation, create your first automation, and optionally turn on detection.
url: https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/get-started
products:
  - Elastic Cloud Serverless
  - Elastic Documentation
  - Elastic Observability
applies_to:
  - Serverless Observability projects: Preview
---

# Get started with Elastic nightshift
Go from a fresh project to your first investigation and your first automation. This guide follows the **Get started** checklist on the Elastic nightshift home page, so you can keep it open next to Kibana. By the end, Elastic nightshift has investigated a real problem in your data and learned the first things about your system.
After setting up your investigations, optionally set up detection to find issues that fall outside of your alerts.

## Before you begin

- **An Elastic Observability Serverless project on the Complete tier.** In Tech Preview, Elastic nightshift runs only in the default space. To check what works with your deployment, refer to [Reference architecture](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/reference-architecture).
- **Data to work with.** Logs, metrics, or traces in your project, or in another cluster that you can reach with an API key.
- **An admin to enable Elastic nightshift and detection.** The predefined **Admin** role can do this. For other roles, refer to [Grant access to Elastic nightshift](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/privileges).
- **Recent logs, if you want to turn on detection.** Detection watches logs in this project or in projects linked by [cross-project search](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/deploy-manage/cross-project-search-config). For other deployment types, refer to [Reference architecture](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/reference-architecture).

You don't need an LLM connector. Elastic nightshift uses the [Elastic Inference Service (EIS)](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/explore-analyze/elastic-inference/eis).
<stepper>
  <step title="Enable {{nightshift}}">
    Open the Elastic nightshift home page by selecting **nightshift** in the navigation menu, or using the [global search field](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/explore-analyze/find-and-organize/find-apps-and-objects). From here, an admin needs to select **Enable Elastic nightshift**.  If you don't see **Enable Elastic nightshift**, ask an admin to do this step.Elastic nightshift runs every investigation as a service account. Refer to [Privileges that Elastic nightshift runs with](/elastic/docs-content/pull/9650/solutions/observability/nightshift/privileges#nightshift-privileges-accounts).
  </step>

  <step title="Add data">
    Choose the Elasticsearch data that investigations query.**If your data is in this project**:  Elastic nightshift automatically creates a **Local Elasticsearch** connector that can read your `logs-*`, `metrics-*`, and `traces-*` data. The **External Elasticsearch** card shows a **1 connector** badge. Select **Proceed**.**If your data is in another cluster or project**:  Add an External Elasticsearch connector. The **Local Elasticsearch** connector searches only this project, so you also need an External Elasticsearch connector for projects linked through [cross-project search](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/deploy-manage/cross-project-search-config). For linked projects, create the API key in the Elastic Cloud console. Refer to [Search projects linked through cross-project search](/elastic/docs-content/pull/9650/solutions/observability/nightshift/investigation/set-up#nightshift-set-up-cps). For what works with each deployment type, refer to [Reference architecture](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/reference-architecture).
    1. Create an API key on the cluster that holds the data. Grant only read access to the indices that you want Elastic nightshift to search. For example, run this request in that cluster's **Console**:
       ```console
       POST /_security/api_key
       {
         "name": "nightshift-elasticsearch",
         "role_descriptors": {
           "nightshift_local_read": {
             "cluster": [],
             "indices": [
               {
                 "names": ["logs-*", "metrics-*", "traces-*"],
                 "privileges": ["read", "view_index_metadata"],
                 "allow_restricted_indices": false
               }
             ]
           }
         }
       }
       ```
       Copy the `encoded` value from the response.
    2. Find the cluster's Elasticsearch endpoint. In the [Elastic Cloud console](https://cloud.elastic.co/), open the project or deployment and copy its Elasticsearch endpoint (the `direct_endpoint`).
    3. From Elastic nightshift, on the **External Elasticsearch** card, select **Connect** → **Create connector**.
    4. Enter a **Connector name** and a **Connector ID**, for example `prod-logs`.
    5. In **Elasticsearch URL**, add the endpoint.
    6. In **API Key**, add the `encoded` value you generated previously.
    7. Keep the default **Actions**, and select **Save**.
    The badge on the **External Elasticsearch** card should show one more connector. Select **Proceed**. For more options, refer to [External Elasticsearch](/elastic/docs-content/pull/9650/solutions/observability/nightshift/investigation/set-up#nightshift-set-up-external-es).
    <tip>
      No data yet? Select **Add data** on the **Add data in 10+ other ways** card to send logs, metrics, and traces, for example with OpenTelemetry or Elastic Agent. Refer to [Get started with Elastic Observability Serverless](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/get-started).
    </tip>
  </step>

  <step title="Connect GitHub (optional)">
    Your telemetry shows *what* is wrong, but your code often shows *why*. Connect GitHub so investigations can read the code, configuration, Helm charts, and runbooks behind your services, and check recent changes.Elastic nightshift doesn't copy or index your repositories. Refer to [Your code](/elastic/docs-content/pull/9650/solutions/observability/nightshift/cost-and-models#nightshift-data).
    1. In GitHub, create a [fine-grained personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token), ideally on a bot or service account, so it keeps working when people change teams.
       - **Repository access**: select only the repositories that Elastic nightshift needs.
       - **Repository permissions**: give read-only access to **Contents**, **Metadata**, **Pull requests**, and **Issues**.
       If your organization uses SAML single sign-on or requires approval for tokens, authorize or approve the token for the organization.
    2. From Elastic nightshift, on the **GitHub** card, select **Connect**.
    3. Enter a **Connector name** and a **Connector ID**. Leave **Receive events** turned off.
    4. Under **Outbound**, select **Personal Access Token (PAT)** and paste your token. Don't use **OAuth 2.0 Authorization Code** because it stores per-user credentials, which the Elastic nightshift service account can't use.
    5. Select **Save**.
    To skip GitHub setup, select **Skip this step**. You can add it later on the **Settings** page. To reach other tools over HTTP, refer to [Connect your data and tools](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/investigation/set-up).
  </step>

  <step title="Try your first investigation">
    You don't need a problem in mind. Elastic nightshift looks at your data first and finds something worth investigating.Elastic nightshift shows **Gathering and triaging signals that can be investigated** while it scans your recent data for error spikes, latency changes, and other potential issues. After a couple of minutes, it suggests problems, each with a type, such as **Latency** or **Error spike**, a title, and the numbers behind it.
    1. Pick a suggestion and select **Investigate**. You can also **Ask your own question** at the end of the list of suggestions, for example "Why is checkout latency up?", and select **Investigate**.
       Elastic nightshift shows **Agent is investigating**.
    2. When **Investigation results are ready**, select **View results** and review the results. Refer to [Read an investigation](/elastic/docs-content/pull/9650/solutions/observability/nightshift/investigation#nightshift-read-investigation).
    3. Select **View hypothesis tree** to check the reasoning: every explanation that Elastic nightshift tested, with a confidence, confirmed or dismissed.
    4. Review the proposed actions: make the change yourself and select **Mark as applied**, or select **Decline**.
    To ask more questions, select **Open chat** from the investigation results. For example, you could ask "How did you reach this conclusion?". For more, refer to [Investigate anything](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/use-cases/investigate-anything).
  </step>

  <step title="Create your first automation">
    An automation starts investigations for you. For example, you could have an investigation start each time an alert fires or every morning at 09:00, and post the results to a Slack channel.
    1. Under **Create first automation**, select **Create automation**.
    2. Enter a **Name**, for example `Investigate critical alerts`.
    3. Under **Trigger**, select **Add trigger**.
    4. Under **Elastic**, select **Alert triggered**. Select **Any rule** and choose the rules, or a rule tag, that you want investigated.
    5. Optional: Under **Notifications**, select **Add notification**, then **Post in Slack**, and pick a channel that an admin has connected. Refer to [Set up Slack](/elastic/docs-content/pull/9650/solutions/observability/nightshift/investigation/set-up#nightshift-set-up-slack).
    6. Select **Save and enable**.
    The automation now investigates each matching alert, within the daily limits. In the checklist, select **Done**. Not ready? Select **Skip this step**. For a full example, refer to [Automatically investigate your alerts](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/use-cases/auto-investigate-alerts).
  </step>

  <step title="Turn on detection (optional)">
    Alerts catch the problems you think of in advance. Detection finds the problems that your alerts don't. Elastic nightshift learns how your system normally behaves, watches for unusual changes, and groups related changes into a significant event, so you review one problem instead of a pile of small alerts. Investigations work without it, so you can turn it on whenever you're ready.
    1. On the Elastic nightshift home page, select **Detections**. If you aren't seeing it, make sure you've completed the **Get started** checklist. If you see **Detection setup requires manage and configure access**, ask an admin to enable it.
    2. Under **Select data sources to analyze**, keep **All logs** (`FROM logs*`) selected. To watch only some of your data, select **Create new source**. Refer to [Manage what detection monitors](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/detection/sources).
    3. Select **Enable detection**.
    A badge by the **Detection engine** heading now shows **Monitoring**, and there's nothing else to turn on. Elastic nightshift starts learning your system, and the first signals appear 40 minutes to about 2.5 hours later, while the rules warm up. After that, a new problem takes about 10 to 30 minutes to detect. Significant events appear only when something unusual happens, so a quiet system can stay at zero for a while.To follow what Elastic nightshift learns, refer to [How detection learns your system](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/detection/learning). To review and investigate events, refer to [Review significant events](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/detection/significant-events). To investigate each new event automatically, refer to [Automatically investigate your alerts](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/use-cases/auto-investigate-alerts).
  </step>
</stepper>


## Review what Elastic nightshift learned

After your first investigation, Elastic nightshift has started a picture of your system: which services you run, which databases they use, and where their telemetry lives. Later investigations start from there. To review this context, open the `boxes_vertical` menu on the home page and select **Knowledge**. Review the **Wiki** and **Memory** tabs to see what it's learned.
If any of the Wiki or Memory articles are outdated, archive them so Elastic nightshift stops using them. Refer to [How Elastic nightshift builds context](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/context).

## What's next

Your home page now lists every investigation, grouped by severity. Refer to [The home page](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/homepage).
Review the following next steps:
- [Elastic nightshift use cases](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/use-cases): Follow step-by-step guides for investigating problems, automating investigations, and detecting problems.
- [How detection works](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/detection): Learn how sources, Knowledge Indicators, rules, and signals fit together.
- [Settings and limits](https://docs-v3-preview.elastic.dev/elastic/docs-content/pull/9650/solutions/observability/nightshift/settings): Pause detection and set its daily limits.