diff --git a/docs/sources/reference/api.md b/docs/sources/reference/api.md index afb3654dbedee..a6fe7cfe14217 100644 --- a/docs/sources/reference/api.md +++ b/docs/sources/reference/api.md @@ -147,10 +147,10 @@ Some Loki API endpoints return a result of a matrix, a vector, or a stream: The API accepts several formats for timestamps: -* An integer with ten or fewer digits is interpreted as a Unix timestamp in seconds. -* More than ten digits are interpreted as a Unix timestamp in nanoseconds. -* A floating point number is a Unix timestamp with fractions of a second. -* A string in `RFC3339` and `RFC3339Nano` format, as supported by Go's [time](https://pkg.go.dev/time) package. +- An integer with ten or fewer digits is interpreted as a Unix timestamp in seconds. +- More than ten digits are interpreted as a Unix timestamp in nanoseconds. +- A floating point number is a Unix timestamp with fractions of a second. +- A string in `RFC3339` and `RFC3339Nano` format, as supported by Go's [time](https://pkg.go.dev/time) package. {{% admonition type="note" %}} When using `/api/v1/push`, you must send the timestamp as a string and not a number, otherwise the endpoint will return a 400 error. @@ -205,7 +205,7 @@ The example below show all possible statistics returned with their respective de ## Ingest logs -``` +```bash POST /loki/api/v1/push ``` @@ -219,7 +219,7 @@ These POST requests require the `Content-Type` HTTP header to be `application/x- Alternatively, if the `Content-Type` header is set to `application/json`, a JSON post body can be sent in the following format: -``` +```json { "streams": [ { @@ -241,7 +241,7 @@ You can optionally attach [structured metadata]({{< relref "../get-started/label The JSON object must be a valid JSON object with string keys and string values. The JSON object should not contain any nested object. The JSON object must be set immediately after the log line. Here is an example of a log entry with some structured metadata attached: -``` +```json "values": [ [ "", "", {"trace_id": "0242ac120002", "user_id": "superUser123"}] ] @@ -261,7 +261,7 @@ curl -H "Content-Type: application/json" \ ## Query logs at a single point in time -``` +```bash GET /loki/api/v1/query ``` @@ -278,7 +278,7 @@ In microservices mode, `/loki/api/v1/query` is exposed by the querier and the qu Response format: -``` +```json { "status": "success", "data": { @@ -291,7 +291,7 @@ Response format: where `` is: -``` +```json { "metric": {