summaryrefslogtreecommitdiffstats
path: root/os-plugins/plugins/syslog
diff options
context:
space:
mode:
Diffstat (limited to 'os-plugins/plugins/syslog')
-rw-r--r--os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm93
-rw-r--r--os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm41
-rw-r--r--os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm322
-rw-r--r--os-plugins/plugins/syslog/XX_syslog.sh31
-rw-r--r--os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh18
-rw-r--r--os-plugins/plugins/syslog/init-hooks/95-cleanup/syslog.sh12
6 files changed, 0 insertions, 517 deletions
diff --git a/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm b/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm
deleted file mode 100644
index ed08c5f3..00000000
--- a/os-plugins/plugins/syslog/OpenSLX/Distro/Base.pm
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright (c) 2008 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your suggestions, praise, or complaints to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org/
-# -----------------------------------------------------------------------------
-# syslog/OpenSLX/Distro/Base.pm
-# - provides base implementation of the Distro API for the syslog plugin.
-# -----------------------------------------------------------------------------
-package syslog::OpenSLX::Distro::Base;
-
-use strict;
-use warnings;
-
-our $VERSION = 1.01; # API-version . implementation-version
-
-use Scalar::Util qw( weaken );
-
-use OpenSLX::Basics;
-use OpenSLX::Utils;
-
-################################################################################
-### interface methods
-################################################################################
-sub new
-{
- my $class = shift;
- my $self = {};
- return bless $self, $class;
-}
-
-sub initialize
-{
- my $self = shift;
- $self->{engine} = shift;
- weaken($self->{engine});
- # avoid circular reference between plugin and its engine
-
- return 1;
-}
-
-sub runlevelInfo
-{
- my $self = shift;
- my $kind = shift;
-
- # most distros (well: Debian & Ubuntu) use a different initscript depending
- # on which version of syslog is installed ('syslogd', 'syslog-ng' or 'rsyslog')
- my %nameMap = (
- 'syslogd' => 'sysklogd',
- 'syslog-ng' => 'syslog-ng',
- 'rsyslog' => 'rsyslog',
- );
- my $rlInfo = {
- scriptName => $nameMap{$kind},
- startAt => 2,
- stopAt => 15,
- };
-
- return $rlInfo;
-}
-
-sub getPackageName
-{
- my $self = shift;
- my $name = shift;
-
- my %nameMap = (
- 'syslogd' => 'sysklogd',
- 'syslog-ng' => 'syslog-ng',
- 'rsyslog' => 'rsyslog',
- );
- return $nameMap{$name};
-}
-
-sub getBinaryName
-{
- my $self = shift;
- my $name = shift;
-
- my %nameMap = (
- 'syslogd' => 'sysklogd',
- 'syslog-ng' => 'syslog-ng',
- 'rsyslog' => 'rsyslogd',
- );
- return $nameMap{$name};
-}
-
-1;
diff --git a/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm b/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm
deleted file mode 100644
index 7255d6f5..00000000
--- a/os-plugins/plugins/syslog/OpenSLX/Distro/Suse.pm
+++ /dev/null
@@ -1,41 +0,0 @@
-# Copyright (c) 2006, 2007 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your suggestions, praise, or complaints to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org/
-# -----------------------------------------------------------------------------
-# syslog/OpenSLX/Distro/Suse.pm
-# - provides SUSE-specific overrides of the Distro API for the syslog plugin.
-# -----------------------------------------------------------------------------
-package syslog::OpenSLX::Distro::Suse;
-
-use strict;
-use warnings;
-
-use base qw(syslog::OpenSLX::Distro::Base);
-
-use OpenSLX::Basics;
-
-################################################################################
-### interface methods
-################################################################################
-
-sub runlevelInfo
-{
- my $self = shift;
- my $attrs = shift;
-
- my $rlInfo = $self->SUPER::runlevelInfo($attrs);
-
- # SUSE uses a script named 'syslog', no matter if syslogd or syslog-ng
- # is installed
- $rlInfo->{scriptName} = 'syslog';
-
- return $rlInfo;
-}
-
-1;
diff --git a/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm b/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
deleted file mode 100644
index c011bf66..00000000
--- a/os-plugins/plugins/syslog/OpenSLX/OSPlugin/syslog.pm
+++ /dev/null
@@ -1,322 +0,0 @@
-# Copyright (c) 2008 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your suggestions, praise, or complaints to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org/
-# -----------------------------------------------------------------------------
-# syslog.pm
-# - implementation of the 'syslog' plugin, which installs
-# all needed information for a displaymanager and for the syslog.
-# -----------------------------------------------------------------------------
-package OpenSLX::OSPlugin::syslog;
-
-use strict;
-use warnings;
-
-use base qw(OpenSLX::OSPlugin::Base);
-
-use File::Basename;
-use File::Path;
-
-use OpenSLX::Basics;
-use OpenSLX::Utils;
-
-sub new
-{
- my $class = shift;
-
- my $self = {
- name => 'syslog',
- };
-
- return bless $self, $class;
-}
-
-sub getInfo
-{
- my $self = shift;
-
- return {
- description => unshiftHereDoc(<<' End-of-Here'),
- Sets up system log service for SLX-clients.
- End-of-Here
- precedence => 50,
- };
-}
-
-sub getAttrInfo
-{
- my $self = shift;
-
- return {
- 'syslog::active' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- should the 'syslog'-plugin be executed during boot?
- End-of-Here
- content_regex => qr{^(0|1)$},
- content_descr => '1 means active - 0 means inactive',
- default => '1',
- },
- 'syslog::kind' => {
- applies_to_vendor_os => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- kind of syslog to use \(syslogd-ng or old-style syslog\)
- End-of-Here
- content_regex => qr{^(syslog-ng|syslogd|rsyslog)$},
- content_descr => 'allowed: syslog-ng, syslogd, rsyslog',
- default => 'rsyslog',
- },
- 'syslog::host' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- name or IP-address of host where syslog shall be sent to
- End-of-Here
- content_regex => undef,
- content_descr => 'a hostname or an IP address',
- default => undef,
- },
- 'syslog::port' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- port number (UDP) where syslog shall be sent to
- End-of-Here
- content_regex => undef,
- content_descr => 'a port number',
- default => 514,
- },
- 'syslog::file' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- name of file where all log messages shall be written
- End-of-Here
- content_regex => undef,
- content_descr => 'a complete file path',
- default => '/var/log/messages',
- },
- };
-}
-
-sub installationPhase
-{
- my $self = shift;
- my $info = shift;
-
- $self->{pluginRepositoryPath} = $info->{'plugin-repo-path'};
- $self->{pluginTempPath} = $info->{'plugin-temp-path'};
- $self->{openslxBasePath} = $info->{'openslx-base-path'};
- $self->{openslxConfigPath} = $info->{'openslx-config-path'};
- $self->{attrs} = $info->{'plugin-attrs'};
-
- # We are going to change some of the stage1 attributes during installation
- # (basically we are filling the ones that are not defined). Since the result
- # of these changes might change between invocations, we do not want to store
- # the resulting values, but we want to store the original (undef).
- # In order to do so, we copy all stage1 attributes directly into the
- # object hash and change them there.
- $self->{kind} = lc($self->{attrs}->{'syslog::kind'});
-
- my $engine = $self->{'os-plugin-engine'};
-
- if ($self->{kind} eq 'rsyslog' && !isInPath($self->{distro}->getBinaryName('rsyslog'))) {
- $engine->installPackages($self->{distro}->getPackageName('rsyslog'));
- }
-
- if ($self->{kind} eq 'syslog-ng' && !isInPath('syslog-ng')) {
- $engine->installPackages($self->{distro}->getPackageName($self->{distro}->getBinaryName('syslog-ng')));
- }
-
- # not sure if we ever should setup this service
- if ($self->{kind} eq 'syslogd' && !isInPath($self->{distro}->getBinaryName('syslogd'))) {
- $engine->installPackages($self->{distro}->getPackageName('syslogd'));
- }
-
- if (!$self->{kind}) {
- if (qx{which $self->{distro}->getBinaryName('rsyslog')}) {
- $self->{kind} = 'rsyslog';
- }
- elsif (qx{which $self->{distro}->getBinaryName('syslog-ng')}) {
- $self->{kind} = 'syslog-ng';
- }
- elsif (qx{which $self->{distro}->getBinaryName('syslogd')}) {
- $self->{kind} = 'syslogd';
- }
- else {
- die _tr(
- "no syslog daemon available, plugin 'syslog' wouldn't work!"
- );
- }
- print _tr("selecting %s as syslog kind\n", $self->{kind});
- }
-
- # start to actually do something - according to current stage1 attributes
- if ($self->{kind} eq 'rsyslog') {
- $self->_setupRsyslog($self->{attrs});
- }
- elsif ($self->{kind} eq 'syslog-ng') {
- $self->_setupSyslogNG($self->{attrs});
- }
- elsif ($self->{kind} eq 'syslogd') {
- $self->_setupSyslogd($self->{attrs});
- }
- else {
- die _tr(
- 'unknown kind "%s" given, only "rsyslog", "syslog-ng" and "syslogd" are supported!',
- $self->{kind}
- );
- }
-
- return;
-}
-
-sub removalPhase
-{
- my $self = shift;
- my $info = shift;
-
- return;
-}
-
-sub _setupRsyslog
-{
- my $self = shift;
- my $attrs = shift;
-
- my $repoPath = $self->{pluginRepositoryPath};
-
- my $kind = lc($attrs->{'syslog::kind'});
- my $rlInfo = $self->{distro}->runlevelInfo($kind);
-
- my $conf = unshiftHereDoc(<<" End-of-Here");
- #!/bin/sh
- # written by OpenSLX-plugin 'syslog'
-
- testmkd /mnt/var/run/rsyslog
- rllinker $rlInfo->{scriptName} $rlInfo->{startAt} $rlInfo->{stopAt}
-
- End-of-Here
- spitFile("$repoPath/syslog.sh", $conf);
-
- return;
-}
-
-sub _setupSyslogNG
-{
- my $self = shift;
- my $attrs = shift;
-
- my $repoPath = $self->{pluginRepositoryPath};
-
- my $kind = lc($attrs->{'syslog::kind'});
- my $rlInfo = $self->{distro}->runlevelInfo($kind);
-
- my $conf = unshiftHereDoc(<<" End-of-Here");
- #!/bin/sh
- # written by OpenSLX-plugin 'syslog'
-
- cat >/mnt/etc/syslog-ng/syslog-ng.conf <<END
- # written by OpenSLX-plugin 'syslog'
- source all {
- file("/proc/kmsg");
- unix-dgram("/dev/log");
- internal();
- };
- destination console_all {
- file("/dev/tty10");
- };
- log {
- source(all);
- destination(console_all);
- };
- END
-
- if [ -n "\${syslog_host}" ]; then
- [ -z \${syslog_port} ] && syslog_port=514
- cat >>/mnt/etc/syslog-ng/syslog-ng.conf <<END
- destination loghost {
- udp( "\${syslog_host}" port(\${syslog_port}) );
- };
- log {
- source(all);
- destination(loghost);
- };
- END
- fi
-
- if [ -n "\${syslog_file}" ]; then
- cat >>/mnt/etc/syslog-ng/syslog-ng.conf <<END
- destination allmessages {
- file("\${syslog_file}");
- };
- log {
- source(all);
- destination(allmessages);
- };
- END
- fi
-
- rllinker $rlInfo->{scriptName} $rlInfo->{startAt} $rlInfo->{stopAt}
-
- End-of-Here
- spitFile("$repoPath/syslog.sh", $conf);
-
- return;
-}
-
-sub _setupSyslogd
-{
- my $self = shift;
- my $attrs = shift;
-
- my $repoPath = $self->{pluginRepositoryPath};
-
- my $kind = lc($attrs->{'syslog::kind'});
- my $rlInfo = $self->{distro}->runlevelInfo($kind);
-
- my $conf = unshiftHereDoc(<<' End-of-Here');
- #!/bin/sh
- # written by OpenSLX-plugin 'syslog'
-
- cat >/mnt/etc/syslog.conf <<END
- # written by OpenSLX-plugin 'syslog'
- *.=debug;\
- auth,authpriv.none;\
- news.none;mail.none -/var/log/debug
- *.=info;*.=notice;*.=warn;\
- auth,authpriv.none;\
- cron,daemon.none;\
- mail,news.none -/var/log/messages
-
- END
-
- if [ -n "\${syslog_host}" ]; then
- [ -z \${syslog_port} ] && syslog_port=514
- cat >/mnt/etc/syslog.conf <<END
- *.* @${syslog_host}
- END
- fi
-
- if [ -n "\${syslog_file}" ]; then
- cat >/mnt/etc/syslog.conf <<END
- *.* ${syslog_file}
- };
- END
- fi
-
- rllinker $rlInfo->{scriptName} $rlInfo->{startAt} $rlInfo->{stopAt}
-
- End-of-Here
- spitFile("$repoPath/syslog.sh", $conf);
-
- return;
-}
-
-1;
diff --git a/os-plugins/plugins/syslog/XX_syslog.sh b/os-plugins/plugins/syslog/XX_syslog.sh
deleted file mode 100644
index 0a96814f..00000000
--- a/os-plugins/plugins/syslog/XX_syslog.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright (c) 2007..2008 - RZ Uni Freiburg
-# Copyright (c) 2008 - OpenSLX GmbH
-#
-# This program/file is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your feedback to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org
-#
-# stage3 part of 'syslog' plugin - the runlevel script
-#
-# script is included from init via the "." load function - thus it has all
-# variables and functions available
-
-# check if the plugin config directory is generally available or if the client
-# configuration failed somehow
-[ -d /initramfs/plugin-conf ] || error "${init_picfg}" nonfatal
-
-if [ -e /initramfs/plugin-conf/syslog.conf ]; then
- . /initramfs/plugin-conf/syslog.conf
- if [ $syslog_active -ne 0 ]; then
- [ $DEBUGLEVEL -gt 0 ] && echo "executing the 'syslog' os-plugin ..."
-
- . /mnt/opt/openslx/plugin-repo/syslog/syslog.sh
-
- [ $DEBUGLEVEL -gt 0 ] && echo "done with 'syslog' os-plugin ..."
-
- fi
-fi
diff --git a/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh b/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh
deleted file mode 100644
index f0ca370f..00000000
--- a/os-plugins/plugins/syslog/init-hooks/15-have-ip-config/syslog.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-if [ -e /initramfs/plugin-conf/syslog.conf ]; then
- . /initramfs/plugin-conf/syslog.conf
- if [ $syslog_active -ne 0 ]; then
- # TODO: maybe limit the maximum log file size via rotation?
- params="-s 0"
- if [ -n "$syslog_host" ]; then
- if [ -n "${syslog_port}" ]; then
- host="${syslog_host}:${syslog_port}"
- else
- host="${syslog_host}"
- fi
- params="$params -R ${host}"
- fi
- echo "syslogd $params ..."
- syslogd $params >/dev/null 2>&1
- klogd >/dev/null 2>&1
- fi
-fi
diff --git a/os-plugins/plugins/syslog/init-hooks/95-cleanup/syslog.sh b/os-plugins/plugins/syslog/init-hooks/95-cleanup/syslog.sh
deleted file mode 100644
index 08076c34..00000000
--- a/os-plugins/plugins/syslog/init-hooks/95-cleanup/syslog.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-if [ -e /initramfs/plugin-conf/syslog.conf ]; then
- . /initramfs/plugin-conf/syslog.conf
- if [ $syslog_active -ne 0 ] && [ -n "$syslog_host" ]; then
- # kill syslogd, as it is going to be replaced by system's syslog soon
- killall syslogd
- # remove links to boot.klog, as that will hang (I suppose that is
- # because we already emptied /dev/kmsg)
- if [ -e /mnt/etc/init.d/boot.klog ]; then
- rm /mnt/etc/init.d/boot.d/*.klog
- fi
- fi
-fi