Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dmotte/msgbuf
🦀 A standalone message buffer application
https://github.com/dmotte/msgbuf
buf buffer cargo cli log logs message message-buffer msg msg-buf msgbuf notification notifications notifier notify rust send telegram text
Last synced: 14 days ago
JSON representation
🦀 A standalone message buffer application
- Host: GitHub
- URL: https://github.com/dmotte/msgbuf
- Owner: dmotte
- License: mit
- Created: 2023-01-11T19:13:09.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-10-20T22:59:41.000Z (18 days ago)
- Last Synced: 2024-10-21T02:55:11.651Z (18 days ago)
- Topics: buf, buffer, cargo, cli, log, logs, message, message-buffer, msg, msg-buf, msgbuf, notification, notifications, notifier, notify, rust, send, telegram, text
- Language: Rust
- Homepage:
- Size: 49.8 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# msgbuf
[![GitHub main workflow](https://img.shields.io/github/actions/workflow/status/dmotte/msgbuf/main.yml?branch=main&logo=github&label=main&style=flat-square)](https://github.com/dmotte/msgbuf/actions)
[![GitHub (Pre-)Release Date](https://img.shields.io/github/release-date-pre/dmotte/msgbuf?logo=github&style=flat-square)](https://github.com/dmotte/msgbuf/releases/latest)
[![GitHub all releases](https://img.shields.io/github/downloads/dmotte/msgbuf/total?logo=github&style=flat-square)](https://github.com/dmotte/msgbuf/releases/latest):crab: A standalone **message buffer** application.
This tool reads text from the **standard input** (`stdin`) stream and divides it into chunks, called "**messages**". Then, for each message, a **notifier** command is invoked on a separate thread.
## Installation
Pre-built binaries are available. You can download the latest version with:
```bash
curl -fLo msgbuf "https://github.com/dmotte/msgbuf/releases/latest/download/msgbuf-$(uname -m)-unknown-linux-gnu"
chmod +x msgbuf
```## Usage
As a sample notifier command we can use _cURL_ to send the text to a _Telegram_ user (as a bot). Example:
```bash
tail -f /var/log/my-log-file | ./msgbuf -- curl -sSXPOST "https://api.telegram.org/bot.../sendMessage" -dchat_id=... --data-urlencode text@- --fail-with-body -w'\n'
```This is a simple graphical representation of what happens when we run the shell line above:
```mermaid
graph LR
tail(fa:fa-gear tail -f fa:fa-scroll)
reader(fa:fa-gear reader)
invoker(fa:fa-gear invoker)
curl(fa:fa-gear curl fa:fa-paper-plane)tail --> reader
subgraph fa:fa-gear msgbuf
reader -- "channel" --> invokerinvoker -- "put" --> msg
msg -- "get" --> invoker
endinvoker --> curl
```> **Note**: for more information on how to use this tool, you can also refer to the help message (`./msgbuf --help`).