---
title: SFTP
summary: Fastly will upload log messages periodically to the server in the format specified in the SFTP object.
url: https://www.fastly.com/documentation/reference/api/logging/sftp
---

Fastly will upload log messages periodically to the server in the format specified in the SFTP object.

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `password` | string | The password for the server. If both <code>password</code> and <code>secret_key</code> are passed, <code>secret_key</code> will be used in preference. |
| `path` | string | The path to upload logs to. |
| `public_key` | string | A PGP public key that Fastly will use to encrypt your log files before writing them to disk. |
| `secret_key` | string | The SSH private key for the server. If both <code>password</code> and <code>secret_key</code> are passed, <code>secret_key</code> will be used in preference. |
| `ssh_known_hosts` | string | A list of host keys for all hosts we can connect to over SFTP. |
| `user` | string | The username for the server. |
| `address` | string | A hostname or IPv4 address. |
| `compression_codec` | string | The codec used for compressing your logs. Valid values are <code>zstd</code>, <code>snappy</code>, and <code>gzip</code>. Specifying both <code>compression_codec</code> and <code>gzip_level</code> in the same API request will result in an error. |
| `format` | string | A Fastly <a href="https://www.fastly.com/documentation/guides/integrations/streaming-logs/custom-log-formats/">log format string</a>. |
| `format_version` | integer | The version of the custom logging format used for the configured endpoint. The logging call gets placed by default in <code>vcl_log</code> if <code>format_version</code> is set to <code>2</code> and in <code>vcl_deliver</code> if <code>format_version</code> is set to <code>1</code>. |
| `gzip_level` | integer | The level of gzip encoding when sending logs (default <code>0</code>, no compression). Specifying both <code>compression_codec</code> and <code>gzip_level</code> in the same API request will result in an error. |
| `log_processing_region` | string | The geographic region where the logs will be processed before streaming. Valid values are <code>us</code>, <code>eu</code>, and <code>none</code> for global. |
| `message_type` | string | How the message should be formatted. |
| `name` | string | The name for the real-time logging configuration. |
| `period` | integer | How frequently log files are finalized so they can be available for reading (in seconds). |
| `placement` | string | Where in the generated VCL the logging call should be placed. If not set, endpoints with <code>format_version</code> of 2 are placed in <code>vcl_log</code> and those with <code>format_version</code> of 1 are placed in <code>vcl_deliver</code>. |
| `port` | integer | The port number. |
| `response_condition` | string | The name of an existing condition in the configured endpoint, or leave blank to always execute. |
| `timestamp_format` | string | A timestamp format. (Read-only) |
| `created_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `deleted_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `service_id` | string | Alphanumeric string identifying the service. (Read-only) |
| `updated_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `version` | string | String identifying a service version. (Read-only) |

## API endpoints

### List SFTP log endpoints

**GET** `/service/{service_id}/version/{version_id}/logging/sftp`

List all of the SFTPs for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Create an SFTP log endpoint

**POST** `/service/{service_id}/version/{version_id}/logging/sftp`

Create a SFTP for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Get an SFTP log endpoint

**GET** `/service/{service_id}/version/{version_id}/logging/sftp/{logging_sftp_name}`

Get the SFTP for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `logging_sftp_name` | string | path | Yes | The name for the real-time logging configuration. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Update an SFTP log endpoint

**PUT** `/service/{service_id}/version/{version_id}/logging/sftp/{logging_sftp_name}`

Update the SFTP for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `logging_sftp_name` | string | path | Yes | The name for the real-time logging configuration. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Delete an SFTP log endpoint

**DELETE** `/service/{service_id}/version/{version_id}/logging/sftp/{logging_sftp_name}`

Delete the SFTP for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `logging_sftp_name` | string | path | Yes | The name for the real-time logging configuration. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

