Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions docs/data-routing/4-destinations/16-logs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: logs
---

| | |
|---|:---:|
|__Latest Version__| `v1.0.0` |
|__Input Content Type__| `application/json` |

:::usage
Sending data to Golioth Logs incurs usage costs after exceeding the free tier.
See [Golioth pricing](https://golioth.io/pricing) for more information.
:::

The Logs destination sends data to [Golioth Logs](/device-management/logging).
Data must have arrived as or been transformed into JSON in order to be delivered
successfully.

The data message timestamp will be used as the time for the entry in Golioth
Logs, and the following JSON fields are supported.

| Attribute | Description |
|-----------|------------------------------------------------------------------------|
| `level` | String indicating the log level (`debug`, `info`, `warn`, `error`). |
| `module` | String indicating the module from which the log message was generated. |
| `msg` | String with log message contents. |

Any additional JSON fields will be stored as metadata with the entry in Golioth
Logs.

### Example Usage

Because Golioth Logs is hosted by Golioth, no configuration or credentials are
required to deliver data to the service.

```yaml
destination:
type: logs
version: v1
```

### Example Input

```json
{
"level": "warn",
"module": "net_sockets",
"msg": "failed to send"
}
```

### Example Output

```json
{
"level": "warn",
"module": "net_sockets",
"msg": "failed to send"
}
```
9 changes: 9 additions & 0 deletions docs/data-routing/5-examples/28-golioth-logs-cbor.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Golioth Logs CBOR
---
import Pipeline from '@site/src/components/usethispipeline'

This simple example matches on any CBOR data message, transforms the payload to
JSON, then delivers it to [Golioth Logs](/device-management/logging).

<Pipeline link='https://console.golioth.io/pipeline?name=Default%20CBOR%20Logs&pipeline=ZmlsdGVyOgogIHBhdGg6ICIvbG9ncyIKICBjb250ZW50X3R5cGU6IGFwcGxpY2F0aW9uL2Nib3IKc3RlcHM6CiAgLSBuYW1lOiBzdGVwLTAKICAgIHRyYW5zZm9ybWVyOgogICAgICB0eXBlOiBjYm9yLXRvLWpzb24KICAgICAgdmVyc2lvbjogdjEKICAgIGRlc3RpbmF0aW9uOgogICAgICB0eXBlOiBsb2dzCiAgICAgIHZlcnNpb246IHYx&enabled=1' />
30 changes: 8 additions & 22 deletions docs/device-management/4-logging/3-sending-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,11 @@ id: sending-logs
title: Sending Logs
---

import Prerequisites from '/docs/_partials-common/prerequisites-platform-setup.md'
import { ProtocolPublishSample } from '/docs/_partials-common/protocol.mdx'

<Prerequisites />

Our platform provides functionality for tracking your devices logs, so you can have a better sense of things that are happening out in the field.

An endpoint is provided on our gateways on the `/logs` path where the device can send log data. Right now only the CoAP gateway is available to use this service.

Data can be sent using query parameters and also on the message body. The message body can be send in CBOR or JSON format and is going to be parsed and we will try to identify the known attributes as presented below. If the body is sent as plain text, it will be saved as the log entry message.

> See the [Device API documentation](/reference/device-api/api-docs/logging)

### Simulating device logs using `coap`

You can simulate sending logs by using `coap` and POSTing data to the `/logs` endpoint.

In the example bellow, we are sending the parameters `module`, `level` and `network` as query parameters and also a message in JSON format in the body containing the log `msg`.

<ProtocolPublishSample path="/logs" method="POST" query={{"module":"sensor", "level": "info", "network": "sensor"}} body={{"msg":"Hello World"}} response="OK"/>

After sending a log entry you can search logs using `goliothctl`. Check the [next page](./searching-logs) for more details on how to do that.
Log messages are delivered to the Golioth Logs service via
[Pipelines](/data-routing). By default, any new Projects created on the Golioth
platform will have a [CBOR logs
Pipeline](/data-routing/examples/golioth-logs-cbor) configured automatically
that will deliver data to Golioth Logs.

See the [Golioth Logs data destination](/data-routing/destinations/logs) for
more information.
26 changes: 0 additions & 26 deletions docs/reference/2-device-api/3-api-docs/5-logging.md

This file was deleted.

10 changes: 10 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@
"source": "/device-management/authentication{,/**}",
"destination": "/connectivity/credentials",
"type": 301
},
{
"source": "/reference/device-api/api-docs/logging",
"destination": "/data-routing/destinations/logs",
"type": 301
}
],
"rewrites": [
Expand Down Expand Up @@ -492,6 +497,11 @@
"source": "/device-management/authentication{,/**}",
"destination": "/connectivity/credentials",
"type": 301
},
{
"source": "/reference/device-api/api-docs/logging",
"destination": "/data-routing/destinations/logs",
"type": 301
}
],
"rewrites": [
Expand Down