aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpsyc://loupsycedyglgamf.onion/~lynX <BM-NB7xa9gEpmJgYp9PVnEdACiZcGmmEJcY>2016-08-10 15:28:10 +0000
committerpsyc://loupsycedyglgamf.onion/~lynX <BM-NB7xa9gEpmJgYp9PVnEdACiZcGmmEJcY>2016-08-10 15:28:10 +0000
commitc37ae6350f2656e3c05ef6420956be2b170574a6 (patch)
treea954aef4cd0223b9a9a18917ea0d2b993841e18f
parent6ec7ac1f0ce397303ea190e17b50ba4c0731178f (diff)
downloadperlpsyc-c37ae6350f2656e3c05ef6420956be2b170574a6.tar.gz
perlpsyc-c37ae6350f2656e3c05ef6420956be2b170574a6.zip
documentation for syslog2psyc
-rw-r--r--Makefile2
-rwxr-xr-xbin/syslog2psyc100
2 files changed, 75 insertions, 27 deletions
diff --git a/Makefile b/Makefile
index 3fc5de2..748c727 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,7 @@ manuals: htdocs $I
15 perldoc -oman bin/psyccmd >$M/man1/psyccmd.1 15 perldoc -oman bin/psyccmd >$M/man1/psyccmd.1
16 perldoc -oman bin/psycplay >$M/man1/psycplay.1 16 perldoc -oman bin/psycplay >$M/man1/psycplay.1
17 perldoc -oman bin/psyclisten >$M/man1/psyclisten.1 17 perldoc -oman bin/psyclisten >$M/man1/psyclisten.1
18 perldoc -oman bin/syslog2psyc >$M/man1/syslog2psyc.1
18 19
19html: htdocs 20html: htdocs
20 perldoc -ohtml bin/remotor >htdocs/remotor.html 21 perldoc -ohtml bin/remotor >htdocs/remotor.html
@@ -23,6 +24,7 @@ html: htdocs
23 perldoc -ohtml bin/psyccmd >htdocs/psyccmd.html 24 perldoc -ohtml bin/psyccmd >htdocs/psyccmd.html
24 perldoc -ohtml bin/psycplay >htdocs/psycplay.html 25 perldoc -ohtml bin/psycplay >htdocs/psycplay.html
25 perldoc -ohtml bin/psyclisten >htdocs/psyclisten.html 26 perldoc -ohtml bin/psyclisten >htdocs/psyclisten.html
27 perldoc -ohtml bin/syslog2psyc >htdocs/syslog2psyc.html
26 28
27htdocs: 29htdocs:
28 mkdir -p $@ $M/man1 $M/man3 30 mkdir -p $@ $M/man1 $M/man3
diff --git a/bin/syslog2psyc b/bin/syslog2psyc
index f4a1c83..7aef0c7 100755
--- a/bin/syslog2psyc
+++ b/bin/syslog2psyc
@@ -3,43 +3,32 @@
3# forwards syslog events to a PSYC target. -lynX 2006 3# forwards syslog events to a PSYC target. -lynX 2006
4# 4#
5# had i known how easy it is, i would have done this 1997 5# had i known how easy it is, i would have done this 1997
6#
7# first set up a pipe where we can get syslog events from:
8# mkfifo /dev/syslog2psyc
9# chown <user> /dev/syslog2psyc
10#
11# then configure /dev/syslog2psyc as the destination for
12# syslog messages. in syslog-ng.conf it may look like this:
13# destination psyc { pipe("/dev/syslog2psyc"); };
14# log { source(src); destination(psyc); };
15#
16# in syslog.conf it may look like this:
17# *.warn;*.err |/dev/syslog2psyc
18#
19# finally run this script as <user>
20# you may later want to refine the type of messages that are
21# forwarded to you.
22#
23# If you don't own an always running PSYC server yet,
24# visit http://www.psyced.org. The psyced LPC sandbox
25# runtime has a syslog.c ready to use in the place/ folder.
26 6
27$target = shift; 7require 5.000;
28$pipe = shift; 8use Net::PSYC;
9use Pod::Usage qw( pod2usage );
10
11$target = shift;
12$pipe = shift;
29$pipe = '/dev/syslog2psyc' unless -r $pipe; 13$pipe = '/dev/syslog2psyc' unless -r $pipe;
30$pipe = '/dev/console' unless -r $pipe; 14$pipe = '/dev/console' unless -r $pipe;
31$pipe = '/dev/xconsole' unless -r $pipe; 15$pipe = '/dev/xconsole' unless -r $pipe;
32$pipe = 0 unless -r $pipe; 16$pipe = 0 unless -r $pipe;
33 17
34die <<X unless $target and $pipe; 18unless ($target and $pipe) {
35please provide target and pipe as parameters, as in 19 print STDERR <<X unless $target and $pipe;
36 $0 psyc://localhost/\@syslog /dev/syslog2psyc 20Please provide target and pipe as parameters, as in
21 $0 psyc://localhost/\@syslog /dev/syslog2psyc
22
23See 'perldoc syslog2psyc' for an installation manual.
24
37X 25X
26 pod2usage;
27 exit;
28}
38 29
39$mc = '_notice_system_event'; 30$mc = '_notice_system_event';
40 31
41use Net::PSYC;
42
43$user = $ENV{'USER'}; 32$user = $ENV{'USER'};
44$host = $ENV{'HOST'}; 33$host = $ENV{'HOST'};
45 34
@@ -60,4 +49,61 @@ close IN;
60 49
61# we indeed get here when syslog gets restarted. 50# we indeed get here when syslog gets restarted.
62# should we sleep and try again? 51# should we sleep and try again?
52sleep 2;
53exit;
54
55
56__END__
57
58=pod
59
60=head1 NAME
61
62syslog2psyc - a daemon that forwards syslog events to a PSYC entity
63
64=head1 SYNOPSIS
65
66 syslog2psyc <target> [<pipe>]
67
68 <target> is a PSYC uniform to send syslog notices to.
69 <pipe> is a non-standard path to the syslog2psyc fifo
70
71=head1 INSTALLATION
72
73First set up a pipe where we can get syslog events from:
74 mkfifo /dev/syslog2psyc
75 chown <user> /dev/syslog2psyc
76
77Then configure /dev/syslog2psyc as the destination for
78syslog messages. In syslog-ng.conf it may look like this:
79 destination psyc { pipe("/dev/syslog2psyc"); };
80 log { source(src); destination(psyc); };
81
82In syslog.conf it may look like this:
83 *.warn;*.err |/dev/syslog2psyc
84
85Finally run this script as <user>.
86You may later want to refine the type of messages that are
87forwarded to you.
88
89If you don't own an always running PSYC server yet,
90visit http://www.psyced.org. The psyced LPC sandbox
91runtime has a syslog.c ready to use in the place/ folder.
92It is reachable at psyc://localhost/\@syslog while your
93PSYC client can enter it by means of /subscribe syslog.
94
95=head1 CAVEATS
96
97As long as Net::PSYC does not provide any encryption, you
98should use this within a trustworthy local network or
99as a localhost service.
100
101=head1 AUTHORS
102
103carlo von lynX.
104
105=head1 COPYRIGHT
63 106
107This program is free software, published under the Affero GNU Public
108License. A disclaimer isn't necessary in my country, nor do I need
109to mention the current year to assert a copyright.