cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

os:linux:etc:log:test-remote-syslog.html



Linux

How to test remote syslog

Perl Script

Execute

$ ./send_syslog.pl syslog_server "test message"

$ ./send_syslog.pl xx.xx.xx.xx "test message"

Script

#!/usr/bin/perl
use strict;
use warnings;
use Sys::Syslog qw(:DEFAULT setlogsock);
 
my $ident    = "test";
my $logopt   = "pid";
my $facility = "local0";
my $priority = "info";
 
my ($sv, $msg) = @ARGV;
 
setlogsock("udp");
$Sys::Syslog::host = $sv;
 
openlog($ident, $logopt, $facility);
syslog($priority, $msg);
closelog();
References



os/linux/etc/log/test-remote-syslog.html.txt · Last modified: 2017/05/14 by admin

Page Tools