Document the new logs endpoint and env variable

**What**
- Document the new logs handler url env variable in the gateway readme
- Document the logs handler in the swagger docs
Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
This commit is contained in:
Lucas Roesler
2019-06-28 19:54:09 +02:00
committed by Alex Ellis
parent 74d08126b3
commit 6868d8a3ce
2 changed files with 57 additions and 3 deletions

View File

@ -332,6 +332,41 @@ paths:
description: Not Found
'500':
description: Internal Server Error
'/system/logs':
get:
summary: Get a stream of the logs for a specific function
produces:
- application/x-ndjson
parameters:
- in: query
name: name
description: Function name
type: string
required: true
- in: query
name: since
description: Only return logs after a specific date (RFC3339)
type: string
required: false
- in: query
name: tail
description: Sets the maximum number of log messages to return, <=0 means unlimited
type: integer
required: false
- in: query
name: follow
description: When true, the request will stream logs until the request timeout
type: boolean
required: false
responses:
'200':
description: Newline delimited stream of log messages
schema:
$ref: '#/definitions/LogEntry'
'404':
description: Not Found
'500':
description: Internal Server Error
'/system/info':
get:
summary: Get info such as provider version number and provider orchestrator
@ -559,6 +594,22 @@ definitions:
example: changeme
required:
- name
LogEntry:
type: object
property:
name:
type: string
description: the function name
instance:
type: string
description: the name/id of the specific function instance
timestamp:
type: string
format: date-time
description: the timestamp of when the log message was recorded
text:
type: string
description: raw log message content
SecretName:
type: object
properties:

View File

@ -45,7 +45,9 @@ See the [openfaas/store](https://github.com/openfaas/store) repo for more.
## Logs
Logs are available at the function level and can be accessed through Swarm or Kubernetes using native tooling. You can also install a Docker logging driver to aggregate your logs. By default functions will not write the request and response bodies to stdout. You can toggle this behaviour by setting `read_debug` for the request and `write_debug` for the response.
Logs are available at the function level via the API.
You can also install a Docker logging driver to aggregate your logs. By default functions will not write the request and response bodies to stdout. You can toggle this behaviour by setting `read_debug` for the request and `write_debug` for the response.
## Tracing
@ -67,6 +69,7 @@ The gateway can be configured through the following environment variables:
| `write_timeout` | HTTP timeout for writing a response body from your function (in seconds). Default: `8` |
| `read_timeout` | HTTP timeout for reading the payload from the client caller (in seconds). Default: `8` |
| `functions_provider_url` | URL of upstream [functions provider](https://github.com/openfaas/faas-provider/) - i.e. Swarm, Kubernetes, Nomad etc |
| `logs_provider_url` | URL of the upstream function logs api provider, optional, when empty the `functions_provider_url` is used |
| `faas_nats_address` | Address of NATS service. Required for asynchronous mode |
| `faas_nats_port` | Port for NATS service. Requrired for asynchronous mode |
| `faas_prometheus_host` | Host to connect to Prometheus. Default: `"prometheus"` |