#!/usr/bin/perl $lines_per_sec = $ARGV[0]; $use_tmpfile = $ARGV[1]; $lines_per_sec ||= 10; $count = 0; $use_tmpfile ||= 0; if (!$use_tmpfile) { $type = 'syslog'; } else { $type = '/tmp/foobar.txt'; } print "Simulating writing $lines_per_sec lines per second to $type\n"; open(FOO,">$type"); while (1) { while ($count < $lines_per_sec) { # rand() makes the line unique so it's always logged $line = "This is a random line that will be logged to test syslog " . rand(); $bytes += length($line); if (!$use_tmpfile) { $cmd = "/usr/bin/logger $line"; system($cmd); } else { print FOO $line . "\n"; } $count++; } $total++; print localtime() . ": Wrote another $lines_per_sec lines to $type ($bytes bytes)\n"; $count = $bytes = 0; sleep 1; } close FOO;