Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/balena-os/log-streamer
Test sending logs to the API log-stream
https://github.com/balena-os/log-streamer
Last synced: about 1 month ago
JSON representation
Test sending logs to the API log-stream
- Host: GitHub
- URL: https://github.com/balena-os/log-streamer
- Owner: balena-os
- License: apache-2.0
- Created: 2022-10-26T19:37:38.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-22T17:55:21.000Z (11 months ago)
- Last Synced: 2024-01-22T22:13:41.649Z (11 months ago)
- Language: TypeScript
- Size: 40 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Log tester
Test sending logs to the API log-stream.
This is only meant to be used for debugging purposes. Abusing the tool may result in API limits being enforced.
## Usage
```
# Install dependencies
$ npm i# Set the credentials as env vars (required)
$ export UUID=
$ export API_KEY=# Start logging. Logs should show on the dashboard and on
# stdout
$ npm run dev
Mon, 27 Feb 2023 21:16:44 GMT - Test message No. 0. Next message in 1(s)
Mon, 27 Feb 2023 21:16:45 GMT - Test message No. 1. Next message in 2(s)
Mon, 27 Feb 2023 21:16:47 GMT - Test message No. 2. Next message in 3(s)
Mon, 27 Feb 2023 21:16:50 GMT - Test message No. 3. Next message in 4(s)
Mon, 27 Feb 2023 21:16:54 GMT - Test message No. 4. Next message in 5(s)
```On a balena device
```
balena run --rm -ti -e UUID=$(cat /mnt/boot/config.json | jq -r .uuid) -e API_KEY=$(cat /mnt/boot/config.json | jq -r .deviceApiKey) ghcr.io/balena-os/log-streamer
```You can also simulate messages coming from specific services
```
# Get the service id
SERVICE_NAME=
SERVICE_ID=$(balena inspect $(balena ps -qa --filter=name=${SERVICE_NAME}_*) | jq -r '.[].Config.Labels | to_entries[] | select(.key | contains("io.balena.service-id")) | .value')# Run the tool
balena run --rm -ti -e UUID=$(cat /mnt/boot/config.json | jq -r .uuid) -e API_KEY=$(cat /mnt/boot/config.json | jq -r .deviceApiKey) -e SERVICE_ID=$SERVICE_ID ghcr.io/balena-os/log-streamer
```## Environment Variables
| Name | Description | Required | Default Value |
| ------------- | -------------------------------------------------------------------- | -------- | ---------------------------- |
| UUID | UUID address of the balena device (for instance, from `config.json`) | true | |
| API_KEY | Device API key to use for authentication | true | |
| API_ENDPOINT | URL to use for testing | false | https://api.balena-cloud.com |
| INITIAL_DELAY | Delay in seconds to start the linear increase | false | 0 |
| DELTA_DELAY | Number of seconds to increase between iterations | false | 1 |