diff --git a/api-docs/swagger.yml b/api-docs/swagger.yml index 3fe5ab6d..fb02b189 100644 --- a/api-docs/swagger.yml +++ b/api-docs/swagger.yml @@ -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: diff --git a/gateway/README.md b/gateway/README.md index f7fd78a3..4d0bf4ce 100644 --- a/gateway/README.md +++ b/gateway/README.md @@ -1,6 +1,6 @@ # Gateway -The API Gateway provides an external route into your functions and collects Cloud Native metrics through Prometheus. The gateway also has a UI built-in which can be used to deploy your own functions or functions from the OpenFaaS Function Store then invoke them. +The API Gateway provides an external route into your functions and collects Cloud Native metrics through Prometheus. The gateway also has a UI built-in which can be used to deploy your own functions or functions from the OpenFaaS Function Store then invoke them. The gateway will scale functions according to demand by altering the service replica count in the Docker Swarm or Kubernetes API. Custom alerts generated by AlertManager are received on the /system/alert endpoint. @@ -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 @@ -60,13 +62,14 @@ X-Call-Id Within a function this is available as `Http_X_Call_Id`. ## Environmental overrides -The gateway can be configured through the following environment variables: +The gateway can be configured through the following environment variables: | Option | Usage | |------------------------|--------------| | `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"` |