Initial commit: LogMaster with Viewer Collector Monitor modes
Some checks failed
LogMaster CI/CD / build-and-test (push) Has been cancelled
LogMaster CI/CD / docker (push) Has been cancelled

This commit is contained in:
2026-05-04 13:50:15 +02:00
commit 44cd9ab001
231 changed files with 29018 additions and 0 deletions

51
send-test-logs.js Normal file
View File

@@ -0,0 +1,51 @@
// Sendet alle 500ms eine zufällige Log-Zeile an den Collector
// Usage: node send-test-logs.js [stream-name] [collector-url]
const http = require('http');
const STREAM = process.argv[2] || 'demo-app';
const BASE = process.argv[3] || 'http://localhost:8081';
const url = new URL(`/collect/${STREAM}`, BASE);
const levels = ['DEBUG', 'INFO', 'INFO', 'INFO', 'WARN', 'ERROR', 'FATAL'];
const components = ['auth', 'db', 'http', 'cache', 'queue', 'api'];
const messages = {
DEBUG: ['Cache hit for key user:42', 'Query took 12ms', 'GC pause 8ms', 'Pool stats: active=3 idle=7'],
INFO: ['Request GET /api/users 200 (45ms)', 'User login: admin@test.com', 'Job completed: sync-data', 'Health check OK'],
WARN: ['Slow query: 2340ms', 'Memory at 82%', 'Rate limit 90%', 'Retry attempt 2/3', 'Cert expires in 7 days'],
ERROR: ['Connection timeout', 'NullPointerException at line 42', '500 POST /api/orders', 'Disk write failed'],
FATAL: ['Database connection lost!', 'Out of memory!', 'Process crash - restarting'],
};
let count = 0;
function sendLog() {
const level = levels[Math.floor(Math.random() * levels.length)];
const comp = components[Math.floor(Math.random() * components.length)];
const msgs = messages[level] || messages.INFO;
const msg = msgs[Math.floor(Math.random() * msgs.length)];
const ts = new Date().toISOString();
const line = `${ts} ${level.padEnd(5)} [${comp}] ${msg}`;
const data = line;
const req = http.request({
hostname: url.hostname,
port: url.port,
path: url.pathname,
method: 'POST',
headers: { 'Content-Type': 'text/plain' },
}, (res) => {
count++;
if (count % 10 === 0) process.stdout.write(`\r Sent: ${count} logs to stream "${STREAM}"`);
});
req.on('error', (e) => console.error(`\n Error: ${e.message}`));
req.write(data);
req.end();
}
console.log(`\n 📡 Sending dummy logs to ${BASE}/collect/${STREAM}`);
console.log(` Press Ctrl+C to stop\n`);
// Send one immediately, then every 500ms
sendLog();
setInterval(sendLog, 500);