--- layout: "http" page_title: "HTTP API: /v1/client/fs" sidebar_current: "docs-http-client-fs" description: |- The '/v1/client/fs` endpoints are used to read the contents of an allocation directory. --- # /v1/client/fs The client `fs` endpoints are used to read the contents of files and directories inside an allocation directory. The API endpoints are hosted by the Nomad client and requests have to be made to the Client where the particular allocation was placed. ## GET
Description
Read contents of a file in an allocation directory.
Method
GET
URL
`/v1/client/fs/cat/`
Parameters
Returns
``` ... 07:49 docker/3e8f0f4a67c2[924]: 1:M 22 Jun 21:07:49.110 # Server started, Redis version 3.2.1 07:49 docker/3e8f0f4a67c2[924]: 1:M 22 Jun 21:07:49.110 * The server is now ready to accept connections on port 6379 ... ```
Description
Read contents of a file in an allocation directory at a particular offset.
Method
GET
URL
`/v1/client/fs/readat/`
Parameters
Returns
``` ... 07:49 docker/3e8f0f4a67c2[924]: 1:M 22 Jun 21:07:49.110 # Server started, Redis version 3.2.1 07:49 docker/3e8f0f4a67c2[924]: 1:M 22 Jun 21:07:49.110 * The server is now ready to accept connections on port 6379 ... ```
Description
Stream contents of a file in an allocation directory.
Method
GET
URL
`/v1/client/fs/stream/`
Parameters
Returns
``` ... { "File":"alloc/logs/redis.stdout.0", "Offset":3604480 "Data": "NTMxOTMyCjUzMTkzMwo1MzE5MzQKNTMx..." } { "File":"alloc/logs/redis.stdout.0", "FileEvent": "file deleted" } ```
Field Reference
The return value is a stream of frames. These frames contain the following fields:
Description
Stream a task's stdout/stderr logs.
Method
GET
URL
`/v1/client/fs/logs/`
Parameters
Returns
``` ... { "File":"alloc/logs/redis.stdout.0", "Offset":3604480 "Data": "NTMxOTMyCjUzMTkzMwo1MzE5MzQKNTMx..." } { "File":"alloc/logs/redis.stdout.0", "FileEvent": "file deleted" } ```
Field Reference
The return value is a stream of frames. These frames contain the following fields:
Description
List files in an allocation directory.
Method
GET
URL
`/v1/client/fs/ls/`
Parameters
Returns
```javascript [ { "Name": "alloc", "IsDir": true, "Size": 4096, "FileMode": "drwxrwxr-x", "ModTime": "2016-03-15T15:40:00.414236712-07:00" }, { "Name": "redis", "IsDir": true, "Size": 4096, "FileMode": "drwxrwxr-x", "ModTime": "2016-03-15T15:40:56.810238153-07:00" } ] ```
Description
Stat a file in an allocation directory.
Method
GET
URL
`/v1/client/fs/stat/`
Parameters
Returns
```javascript { "Name": "redis-syslog-collector.out", "IsDir": false, "Size": 96, "FileMode": "-rw-rw-r--", "ModTime": "2016-03-15T15:40:56.822238153-07:00" } ```