https://github.com/rypi-dev/logger-server
https://github.com/rypi-dev/logger-server
api api-server fluent-bit golang log logger logger-server rypi rypi-dev server
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rypi-dev/logger-server
- Owner: rypi-dev
- Created: 2025-08-06T03:34:15.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-08-07T19:19:39.000Z (11 months ago)
- Last Synced: 2025-08-07T21:19:40.930Z (11 months ago)
- Topics: api, api-server, fluent-bit, golang, log, logger, logger-server, rypi, rypi-dev, server
- Language: Go
- Homepage:
- Size: 44.9 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ฆ logger-server
> A lightweight, fast, and extensible logging server built in Go, designed to collect, store, and query your logs efficiently. Works seamlessly with Fluent Bit to forward logs via HTTP.
---
## ๐ Features
- ๐ฅ High-performance logging backend in Go
- ๐ HTTP API for log ingestion and querying
- ๐งฉ Context-aware logs with JSON support
- ๐ก๏ธ API key authentication support (planned)
- ๐ฆ Fluent Bit integration out of the box
- โ๏ธ Pagination, filtering by log level, and timestamp support
- ๐งช Fully tested with coverage reports
- ๐ณ Ready for Docker deployment
---
## ๐ Table of Contents
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Configuration](#โ๏ธ-configuration)
- [Usage](#๐-usage)
- [API Reference](#๐-api-reference)
- [Testing](#๐งช-testing)
- [License](#๐-license)
---
## Getting Started
### Prerequisites
Make sure you have:
- Go 1.20+ installed ๐น
- Fluent Bit installed and configured ๐ฆ
- (Optional) Docker installed if you want to run with containers ๐ณ
### Installation
Clone the repo:
```bash
git clone https://github.com/rypi-dev/logger-server.git
cd logger-server
```
Install dependencies and build:
```bash
go mod download
go build -o logger-server cmd/main.go
```
Run the server:
```bash
./logger-server
```
By default, it listens on port 8080 for incoming logs.
### โ๏ธ Configuration
Fluent Bit Integration
Fluent Bit is configured to forward logs as JSON via HTTP to the logger-server.
Sample Fluent Bit config snippet:
```ini
[INPUT]
Name http
Listen 0.0.0.0
Port 8888
Format json
Tag incoming.log
[FILTER]
Name lua
Match incoming.*
script lua/inject_header.lua
call add_log_level_header
[FILTER]
Name modify
Match incoming.*
Add stack multi-lang
[OUTPUT]
Name http
Match incoming.*
Host logger-server
Port 8080
URI /log
Format json
Header Content-Type application/json
Header X-Log-Level ${X-Log-Level}
```
## ๐ Usage
### Sending logs
Send JSON logs to http://localhost:8080/log with the following payload:
```json
{
"level": "INFO",
"message": "User logged in",
"timestamp": "2025-08-06T14:12:00Z",
"context": {
"user_id": 42
}
}
```
### Querying logs
You can query logs with pagination and filtering by log level:
```pgsql
GET /logs?page=1&limit=50&level=ERROR
```
## ๐ API Reference
- POST /log โ Ingest a new log entry
- GET /logs โ Query logs with filters (page, limit, level)
Request and response formats follow JSON standards.
## ๐งช Testing
Run all tests and check coverage:
```bash
make ci
```
Generate HTML coverage report:
```bash
make report
```
Open `coverage.html` in your browser to visualize test coverage.
## ๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
## ๐ฌ Contact
For any questions or suggestions, open an issue or reach out directly on GitHub!