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

# Ankra Hosted Logs

> Keep a cluster's container logs in Ankra for 7 days, with no log store of your own, and search them from an application's log history. Turn it on from the application, the cluster's settings or the CLI.

export const CliVersion = ({since, command, note}) => {
  const latestStableCli = "0.27.0";
  const parse = version => String(version).split(".").map(part => parseInt(part, 10) || 0);
  const requested = parse(since);
  const stable = parse(latestStableCli);
  let isPrerelease = false;
  for (let index = 0; index < 3; index += 1) {
    if (requested[index] > stable[index]) {
      isPrerelease = true;
      break;
    }
    if (requested[index] < stable[index]) {
      break;
    }
  }
  const containerStyle = {
    display: "flex",
    alignItems: "baseline",
    gap: "0.6rem",
    margin: "1rem 0",
    padding: "0.6rem 0.9rem",
    border: "1px solid rgba(128, 128, 128, 0.35)",
    borderRadius: "0.5rem",
    fontSize: "0.9em",
    lineHeight: 1.5
  };
  const pillStyle = {
    flex: "none",
    padding: "0.1rem 0.5rem",
    borderRadius: "999px",
    background: "rgba(128, 128, 128, 0.18)",
    fontFamily: "ui-monospace, SFMono-Regular, Menlo, monospace",
    fontSize: "0.85em",
    fontWeight: 600,
    whiteSpace: "nowrap"
  };
  const keepTogether = {
    whiteSpace: "nowrap"
  };
  return <div style={containerStyle} data-cli-version={since}>
      <span style={pillStyle}>CLI v{since}+</span>
      <span>
        {command ? <span>
            <span style={keepTogether}>
              <code>ankra {command}</code>
            </span>{" "}
            needs
          </span> : <span>The commands on this page need</span>}{" "}
        the ankra CLI <strong style={keepTogether}>v{since} or later</strong>
        {isPrerelease ? <span>
            {" "}
            - a pre-release today, so enable the{" "}
            <a href="/integrations/ankra-cli#beta-pre-release-channel">beta channel</a> before
            upgrading
          </span> : null}
        . Check yours with{" "}
        <span style={keepTogether}>
          <code>ankra --version</code>
        </span>
        ; <a href="/integrations/ankra-cli#upgrading-the-cli">upgrade</a> with{" "}
        <span style={keepTogether}>
          <code>ankra upgrade</code>
        </span>
        .{note ? <span> {note}</span> : null}
      </span>
    </div>;
};

An application's log **History** searches the logs its cluster keeps. Ankra hosted logs keeps them for you: the cluster's agent sends the log lines of every running container on the cluster to Ankra, where they are kept for 7 days and can be searched from each application's log history. There is no logging stack to install, run or connect.

Hosted logs are off by default and turned on per cluster. Nothing leaves a cluster until someone with permission to change it turns them on.

| | |
| - | - |
| **What is sent** | The log lines of every running container on the cluster |
| **Kept for** | 7 days, in Ankra's own log store |
| **Price** | Included during the pilot. The bytes and lines accepted are recorded as [usage](/platform/usage). |
| **Who can read them** | Members of your organisation, in each application's log history |
| **Who can turn them on or off** | People with the `clusters.write` permission on the cluster |

* **History starts when you turn it on.** Lines written while hosted logs are off are never sent later.
* **Your own log store comes first.** While a [log source](/integrations/log-sources) of your own is connected to the cluster, log history searches that store instead.
* **Live logs need none of this.** **Live** reads the running containers through the cluster's agent, with or without hosted logs.

<Note>
  Ankra turns hosted logs on platform by platform. Where they are not offered yet, you can still turn them on for a cluster, and nothing is sent until they are. The cluster's settings and `ankra cluster logs-ship status` say which applies to yours.
</Note>

***

## Before you start

* **The cluster's agent must follow the switch.** An agent that is too old, or that has log shipping turned off in its own Helm values (`logs_ship.enabled`), sends nothing whatever the switch says. Upgrade it with `ankra cluster agent upgrade --cluster <cluster>`, or turn on automatic agent upgrades in the cluster's settings.
* **Your role needs `clusters.write` on the cluster.** Anyone else is told which roles can turn hosted logs on. See [Roles and access](/guides/roles-and-access).

***

## Turn it on from an application

<Steps>
  <Step title="Open the application's logs">
    In the new Ankra portal, open the application, choose **Health**, then **Logs**.
  </Step>

  <Step title="Choose History">
    When the cluster keeps no logs, History says so instead of showing an empty list: **Ankra hosted logs are off for this cluster.**, or **No log store is connected to this cluster.**
  </Step>

  <Step title="Choose Turn on Ankra hosted logs">
    A dialog says what is sent, how long it is kept, that it is included during the pilot, and that lines written while it is off are never sent later.
  </Step>

  <Step title="Confirm">
    Choose **Turn on hosted logs**. History then reads **Waiting for the first logs from \<cluster>.** and checks again every few seconds. The agent starts sending within a minute or two.
  </Step>
</Steps>

Hosted logs are turned on for the whole cluster, so every application with an environment on that cluster gets log history from then on.

***

## Turn it on from the cluster's settings

In the new Ankra portal, open the cluster, choose **Settings** and find **Ankra hosted logs**. It says in one sentence whether the cluster sends its logs to Ankra, and when that was last changed. Choose **Turn on hosted logs**, read the dialog, and confirm with **Turn on hosted logs**.

The same section turns hosted logs off: see [Turn it off](#turn-it-off).

***

## Turn it on with the CLI

<CliVersion since="0.24.0" />

Check the cluster first:

```bash theme={null}
ankra cluster logs-ship status --cluster <cluster>
```

The status says whether the cluster ships its logs, whether hosted logs are offered on your platform yet, and whether the cluster's agent follows the switch. Then turn it on:

```bash theme={null}
ankra cluster logs-ship enable --cluster <cluster>
```

`enable` says what is sent and asks before it turns anything on. `--yes` answers the question for scripts.

***

## What History tells you

When History has nothing to show, it says why, with the next step:

| What you see | What it means | What to do |
| - | - | - |
| **Ankra hosted logs are off for this cluster.** | Hosted logs are offered here but turned off for this cluster | **Turn on Ankra hosted logs**, or ask someone with one of the roles it names |
| **No log store is connected to this cluster.** | Neither hosted logs nor a store of your own keeps this cluster's logs | **Turn on Ankra hosted logs**, or **Connect your own log store**. Where hosted logs are not offered yet, History says so and offers only a store of your own. |
| **This cluster's agent cannot send logs to Ankra yet.** | The agent is too old to follow the switch, or log shipping is off in its own settings | Upgrade the agent with the command shown |
| **Waiting for the first logs from \<cluster>.** | Hosted logs were just turned on | Wait a minute or two. Lines written before it was turned on are not sent. |
| **Nothing from \<cluster> reached Ankra in the \<time range>.** | Hosted logs are on, but no line from the cluster arrived | **Check the cluster**: its agent sends the lines, so make sure it is connected |
| **Ankra's hosted logs hold nothing from \<namespace> in the \<time range>.** | Lines from the cluster arrive, but the application's containers wrote nothing in this window or were not running | Choose a longer time range, or read **Live** logs |

***

## Turn it off

In the cluster's **Settings**, under **Ankra hosted logs**, choose **Turn off hosted logs** and confirm. With the CLI:

```bash theme={null}
ankra cluster logs-ship disable --cluster <cluster>
```

The cluster stops sending its container logs to Ankra within a minute. Lines already sent stay readable until they are 7 days old. Lines written while hosted logs are off are never sent later.

***

## Related

<CardGroup cols={2}>
  <Card title="Logs" icon="scroll" href="/platform/logs">
    Stream live logs from any workload through the cluster's agent.
  </Card>

  <Card title="Log sources" icon="plug" href="/integrations/log-sources">
    Connect Loki, Elasticsearch or OpenSearch instead.
  </Card>

  <Card title="Usage" icon="chart-line" href="/platform/usage">
    The hosted logs bytes and lines Ankra accepted, per cluster and period.
  </Card>

  <Card title="Cluster settings" icon="gear" href="/platform/cluster-settings">
    The agent version, automatic upgrades and other per-cluster settings.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.