You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
523 B
17 lines
523 B
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 });
|
|
}
|
|
}
|