@@ -21,4 +21,39 @@ foreach ($config['rules'] as $rule) {
|
||||
echo sprintf(" + Rule #%d: %s (%s)\n", $r->id, $r->name, $r->severity->value);
|
||||
}
|
||||
|
||||
echo "Seeding default log sources...\n";
|
||||
|
||||
$existing = $repo->getSources();
|
||||
$existingNames = array_map(fn($s) => $s->name, $existing);
|
||||
|
||||
if (!in_array('syslog-tcp', $existingNames)) {
|
||||
$s = $repo->createSource(
|
||||
name: 'syslog-tcp',
|
||||
type: LogSourceType::Tcp,
|
||||
address: 'tcp://0.0.0.0:9514',
|
||||
labels: ['protocol' => 'syslog'],
|
||||
);
|
||||
echo sprintf(" + Source #%d: syslog-tcp (TCP :9514)\n", $s->id);
|
||||
}
|
||||
|
||||
if (!in_array('syslog-udp', $existingNames)) {
|
||||
$s = $repo->createSource(
|
||||
name: 'syslog-udp',
|
||||
type: LogSourceType::Udp,
|
||||
address: 'udp://0.0.0.0:9514',
|
||||
labels: ['protocol' => 'syslog'],
|
||||
);
|
||||
echo sprintf(" + Source #%d: syslog-udp (UDP :9514)\n", $s->id);
|
||||
}
|
||||
|
||||
if (!in_array('collect-volume', $existingNames)) {
|
||||
$s = $repo->createSource(
|
||||
name: 'collect-volume',
|
||||
type: LogSourceType::File,
|
||||
address: '/collect/*.log',
|
||||
labels: ['type' => 'shared-volume'],
|
||||
);
|
||||
echo sprintf(" + Source #%d: collect-volume (/collect/*.log)\n", $s->id);
|
||||
}
|
||||
|
||||
echo "Done.\n";
|
||||
Reference in New Issue
Block a user