import { NextResponse } from 'next/server'; import fs from 'fs'; import path from 'path'; const syslogPath = '/var/log/syslog'; // Update to '/var/log/messages' if needed export async function GET() { try { const logs = fs.readFileSync(syslogPath, 'utf8'); const tftpLogs = logs.split('\n').filter(line => line.includes('tftpd')); return NextResponse.json({ logs: tftpLogs }); } catch (error) { return NextResponse.json({ error: 'Failed to read logs' }, { status: 500 }); } }