@page
@model Status.Pages.Admin.IngestModel
@{
    ViewData["Title"] = "Log Ingestion";
    ViewData["Page"] = "admin-ingest";
    var host = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host}";
}

<div class="section-title mb-2">Log Ingestion API</div>
<p style="color:var(--text-muted);margin-bottom:20px;font-size:13px">
    Status accepts logs from any application via HTTP POST. Compatible with custom HTTP sinks from Serilog, NLog, log4net, and any HTTP client.
</p>

<div class="two-col" style="align-items:start">
<div>
<div class="card mb-2">
    <div class="card-header"><span class="card-title">Single Log Entry</span></div>
    <div class="card-body">
        <div style="font-family:var(--font-mono);font-size:11px;background:var(--bg-base);padding:14px;border-radius:4px;line-height:1.8;white-space:pre-wrap;overflow-x:auto">POST @host/api/logs/ingest
Content-Type: application/json

{
  "source": "my-app",
  "level": "error",
  "message": "Something went wrong",
  "exception": "System.Exception: ...",
  "properties": "{\"userId\": 42}",
  "host": "prod-server-01",
  "traceId": "abc123"
}</div>
    </div>
</div>

<div class="card mb-2">
    <div class="card-header"><span class="card-title">Batch Ingestion</span></div>
    <div class="card-body">
        <div style="font-family:var(--font-mono);font-size:11px;background:var(--bg-base);padding:14px;border-radius:4px;line-height:1.8;white-space:pre-wrap;overflow-x:auto">POST @host/api/logs/batch
Content-Type: application/json

[
  {"source":"app","level":"info","message":"Started"},
  {"source":"app","level":"warn","message":"Slow query","properties":"{\"ms\":2400}"}
]</div>
    </div>
</div>
</div>

<div>
<div class="card mb-2">
    <div class="card-header"><span class="card-title">EonaCat.LogStack HTTP Flow (.NET)</span></div>
    <div class="card-body">
        <div style="font-family:var(--font-mono);font-size:11px;background:var(--bg-base);padding:14px;border-radius:4px;line-height:1.8;white-space:pre-wrap;overflow-x:auto">// Install: EonaCat.LogStack
var logger = new LogBuilder().WriteToHttp("@host/api/logs/eonacat").Build();
        </div>
    </div>
</div>

<div class="card mb-2">
    <div class="card-header"><span class="card-title">Serilog HTTP Sink (.NET)</span></div>
    <div class="card-body">
        <div style="font-family:var(--font-mono);font-size:11px;background:var(--bg-base);padding:14px;border-radius:4px;line-height:1.8;white-space:pre-wrap;overflow-x:auto">
// Install: Serilog.Sinks.Http
Log.Logger = new LoggerConfiguration()
.WriteTo.Http(
requestUri: "@host/api/logs/serilog",
queueLimitBytes: null)
.CreateLogger();
        </div>
    </div>
</div>

        <div class="card mb-2">
            <div class="card-header">
                <span class="card-title">Syslog (UDP)</span>
            </div>
            <div class="card-body">
                <div style="font-family:var(--font-mono);font-size:11px;background:var(--bg-base);padding:14px;border-radius:4px;line-height:1.8;white-space:pre-wrap;overflow-x:auto">
# Send a syslog message using netcat (Linux/macOS)

echo "&lt;14&gt;1 $(date -u +%Y-%m-%dT%H:%M:%SZ) my-host my-app - - - Hello from syslog" \
| nc -u -w0 YOUR_HOST 514

# Example using logger (Linux)

logger -n YOUR_HOST -P 514 "Hello from syslog"


# Example raw syslog message (RFC5424)

&lt;14&gt;1 2026-03-28T12:00:00Z my-host my-app - - - Something happened


# Example JSON over syslog (auto-detected)

{
"source": "my-app",
"level": "error",
"message": "Something failed",
"host": "server-01",
"traceId": "abc123"
}
                </div>
            </div>
        </div>

<div class="card mb-2">
    <div class="card-header"><span class="card-title">Python (requests)</span></div>
    <div class="card-body">
        <div style="font-family:var(--font-mono);font-size:11px;background:var(--bg-base);padding:14px;border-radius:4px;line-height:1.8;white-space:pre-wrap;overflow-x:auto">import requests

requests.post("@host/api/logs/ingest", json={
    "source": "my-python-app",
    "level": "info",
    "message": "App started",
    "host": socket.gethostname()
})</div>
    </div>
</div>

<div class="card">
    <div class="card-header"><span class="card-title">Log Levels</span></div>
    <div class="card-body">
        <table class="data-table">
            <tr><td><span class="badge badge-unknown">DEBUG</span></td><td style="font-size:12px">Verbose diagnostic info</td></tr>
            <tr><td><span class="badge badge-info">INFO</span></td><td style="font-size:12px">Normal operation events</td></tr>
            <tr><td><span class="badge badge-warn">WARNING</span></td><td style="font-size:12px">Warning requires attention</td></tr>
            <tr><td><span class="badge badge-down">ERROR</span></td><td style="font-size:12px">Errors requiring attention</td></tr>
            <tr><td><span class="badge badge-down">CRITICAL</span></td><td style="font-size:12px">System critical failure / crash</td></tr>
        </table>
    </div>
</div>
</div>
</div>
