# EonaCat.LogStack.Status 🟢

A self-hosted, application monitoring platform.

## Features

| Category | Details |
|----------|---------|
| **TCP Monitor** | Port connectivity checks |
| **UDP Monitor** | UDP reachability checks |
| **HTTP/HTTPS Monitor** | Full HTTP status monitoring |
| **App (Local)** | Monitor local processes by name |
| **App (Remote)** | Remote TCP-based app health |
| **Certificate Manager** | Track SSL certs, expiry, issuer |
| **Certificate Checker** | Auto-refresh cert details hourly |
| **Log Aggregator** | Ingest logs from any app via HTTP |
| **Log Viewer** | Search, filter, paginate log stream |
| **Dashboard** | Live status overview with uptime bars |
| **Admin Panel** | Full CRUD for all resources |
| **Visibility Control** | Per-monitor public/private toggle |
| **REST API** | Log ingestion + status endpoints |

## Quick Start

### Prerequisites
- [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8)

### Run

```bash
cd EonaCat.LogStack.Status
dotnet run
```

Open: http://localhost:8000

### Default Admin Password
`adminEonaCat` - **Change this immediately** in Settings!

## Log Ingestion

Send logs from any app:

```bash
# Single log
curl -X POST http://localhost:8000/api/logs/ingest \
  -H "Content-Type: application/json" \
  -d '{"source":"my-app","level":"error","message":"Something broke"}'

# Batch
curl -X POST http://localhost:8000/api/logs/batch \
  -H "Content-Type: application/json" \
  -d '[{"source":"app","level":"info","message":"Started"},{"source":"app","level":"warn","message":"High memory"}]'
```

### EonaCat.LogStack HTTP Flow
```csharp
var logger = new LogBuilder().WriteToHttp("http://localhost:8000/api/logs/eonacat").Build();
```

### Serilog (.NET)
```csharp
// Install: Serilog.Sinks.Http
Log.Logger = new LoggerConfiguration()
    .WriteTo.Http("http://localhost:8000/api/logs/serilog")
    .CreateLogger();
```

### Python
```python
import requests
requests.post("http://localhost:8000/api/logs/ingest", json={
    "source": "my-python-app", "level": "info", "message": "Hello"
})
```

---

## API Endpoints

| Method | Path | Description |
|--------|------|-------------|
| `GET` | `/api/status/summary` | Dashboard stats |
| `GET` | `/api/monitors` | All public monitors |
| `GET` | `/api/monitors/{id}/check` | Trigger check |
| `POST` | `/api/logs/ingest` | Ingest single log |
| `POST` | `/api/logs/batch` | Ingest log array |
| `POST` | `/api/logs/eonacat` | EonaCat.LogStack HTTP Flow |
| `POST` | `/api/logs/serilog` | Serilog HTTP sink |
| `GET` | `/api/logs` | Query logs (admin) |

---

## Visibility Model

- **Public monitors** are visible to everyone
- **Private monitors** are visible to admins only
- **Log viewer** is admin-only
- **Uptime %** can be toggled public/private in Settings
- **Certificates** are always visible (toggle per cert coming soon)

---

## Production Deployment

```bash
dotnet publish -c Release -o ./publish
# Run with:
./publish/EonaCat.LogStack.Status
```

Or with Docker:
```dockerfile
FROM mcr.microsoft.com/dotnet/aspnet:8.0
WORKDIR /app
COPY ./publish .
EXPOSE 8080
ENTRYPOINT ["dotnet", "EonaCat.LogStack.Status.dll"]
```