# SFTP, SMB and NFS

URL: /collect/sources/file-shares

Read logs from a directory on a ground station or log server over SFTP, polled on a schedule, or from a network share that the Foxborne worker mounts read-only.



When logs sit in a directory on a ground station or log server, connect that directory instead of copying files by hand. Foxborne reads it over SFTP with a key-based, read-only account, or mounts a network share read-only on its worker.

## Before you start [#before-you-start]

* You need the **Admin** role.
* **For SFTP:** an account on the server that can read the log directory and nothing else, and signs in with an SSH key.
* **For SMB or NFS:** the share's path and a service account with read access to it.
* The Foxborne worker can reach the server or the share.

## SFTP [#sftp]

Use **SFTP** for &#x2A;*A directory on a ground station or log server, polled on a schedule.**

<Steps>
  <Step title="Create a read-only account">
    On the server, create an account that can read the log directory and nothing else, and let it sign in with an SSH key only. The example dataset's account is `foxborne-ro`, with an ed25519 key.
  </Step>

  <Step title="Fill in the fields">
    In **Sources**, select **Add source**, pick **SFTP** under **File shares** and select **Continue**.

    | Field                  | Example in the console                           | What to enter                         |
    | ---------------------- | ------------------------------------------------ | ------------------------------------- |
    | **Name**               | For example: Fleet log archive, west range       | A name the team will recognize.       |
    | **Host and directory** | `sftp://gs3.field.internal/var/log/mav-receive/` | The server and the directory to read. |
    | **Account**            | `foxborne-ro`                                    | The read-only account.                |
    | **File pattern**       | `*.jsonl`                                        | Which files to read.                  |
  </Step>

  <Step title="Test and add">
    Select **Test connection**. The four checks confirm that Foxborne reaches the server and lists the directory, and that a write and a delete are refused. Then select **Add source**.
  </Step>

  <Step title="Set the polling interval">
    A new source starts on **Watch for new files**. To poll at a fixed interval instead, open its drawer, select **Edit** and set **Schedule**, for example to **Poll every 5 minutes**. &#x2A;*Changes apply from the next sync.**
  </Step>
</Steps>

The example dataset's **Range control receive logs** source works this way. It reads `sftp://rc1.range.hfr.internal/var/log/mav-receive/` with the pattern `*.jsonl` and polls every 5 minutes. Its drawer shows **Key-based, read-only account** under **Access** and &#x2A;*foxborne-ro (ed25519)** under **Credential**.

## SMB and NFS shares [#smb-and-nfs-shares]

Use **SMB or NFS share** for &#x2A;*A network share mounted read-only on the Foxborne worker.** The worker mounts the share read-only and reads it through the service account.

<Steps>
  <Step title="Give the service account read access">
    Grant the service account read permission on the share and nothing more. The connection test confirms that writes and deletes are refused.
  </Step>

  <Step title="Fill in the fields">
    In **Sources**, select **Add source**, pick **SMB or NFS share** under **File shares** and select **Continue**.

    | Field               | Example in the console                     | What to enter                                                     |
    | ------------------- | ------------------------------------------ | ----------------------------------------------------------------- |
    | **Name**            | For example: Fleet log archive, west range | A name the team will recognize.                                   |
    | **Share**           | `\\fs01\flightops\logs`                    | The share's network path. For an NFS export, enter its path here. |
    | **Service account** | `DOMAIN\svc-foxborne-ro`                   | The read-only service account.                                    |
    | **File pattern**    | `*.json`                                   | Which files to read.                                              |
  </Step>

  <Step title="Test and add">
    Select **Test connection**, wait for the fourth check, then select **Add source**.
  </Step>
</Steps>

The example dataset's **Legacy journal share** reads journal exports, `*.json`, from `\\fs01.hfr.internal\fieldops\journals` through a read-only service account.

## Pause a share during a migration [#pause-a-share-during-a-migration]

Pause a share before you move it, so Foxborne stops reading while the files are in transit. The example dataset's **Legacy journal share** was paused on 12 Sep while the share was migrated.

<Steps>
  <Step title="Pause the source">
    Open the source's drawer, select **Pause** and confirm with **Pause source**. The dialog explains the effect: &#x2A;*Foxborne stops reading new files from this source. Files already imported stay as they are.**

    The status changes to **Paused** and **Sync now** becomes unavailable. The note reads **Paused by** with your name and the date, and the audit log records **Paused source**.
  </Step>

  <Step title="Point the source at the new path">
    When the share has moved, select **Edit** and change **Location** to the new path. &#x2A;*Changes apply from the next sync.** The audit log records **Edited source**.
  </Step>

  <Step title="Resume">
    Select **Resume**. Foxborne starts reading again at once, the status returns to **Healthy** and the note clears.

    For an SMB or NFS share, the schedule becomes **Poll every 15 minutes**. The audit log records **Resumed source**.
  </Step>
</Steps>

## Check the result [#check-the-result]

* A new source appears in **Connections** with **Read-only, verified** under **Access** and **Healthy** under **Status**.
* The drawer shows the path under **Location**, the account under **Credential**, your pattern under **Matches** and the interval under **Schedule**.
* The audit log records **Added source** with a detail such as **SFTP, read-only test passed**.

## Troubleshoot [#troubleshoot]

* **Sync now is unavailable.** The source is paused. Select **Resume** first.
* **Status shows Needs attention or Error.** Open the source's drawer and read the note at the top.
* **Files land on the wrong vehicle.** Mark the part of the path that names the vehicle with `{vehicle}` in **File pattern**. Or leave it out, and let the system ID in each flight log decide.

## Next [#next]

* [Connect a storage source](/collect/sources) covers every source type, the drawer and its actions.
* [MAVLink ground receiver](/collect/receiver) explains the receive logs range control writes.
* [journalctl JSON exports](/collect/formats/journald) explains the journal exports a share can hold.
