Tony Murray 38773598e0 Fix syslog widget priority filtering (#13411)
* Fix widget filtering
syslog stores priority as a string
filter strings, not numbers

* Add enums for SyslogSeverity and CheckStatus
2021-10-29 10:32:36 +02:00

41 lines
1.3 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Syslog;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\Factory;
use LibreNMS\Enum\SyslogSeverity;
/** @extends Factory<Syslog> */
class SyslogFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Syslog::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$facilities = ['kern', 'user', 'mail', 'daemon', 'auth', 'syslog', 'lpr', 'news', 'uucp', 'cron', 'authpriv', 'ftp', 'ntp', 'security', 'console', 'solaris-cron', 'local0', 'local1', 'local2', 'local3', 'local4', 'local5', 'local6', 'local7'];
$levels = SyslogSeverity::LEVELS;
return [
'facility' => $this->faker->randomElement($facilities),
'priority' => $this->faker->randomElement($levels),
'level' => $this->faker->randomElement($levels),
'tag' => $this->faker->asciify(str_repeat('*', $this->faker->numberBetween(0, 10))),
'timestamp' => Carbon::now(),
'program' => $this->faker->asciify(str_repeat('*', $this->faker->numberBetween(0, 32))),
'msg' => $this->faker->text(),
];
}
}