summaryrefslogtreecommitdiff
blob: ca1f50ba2cc2c298a07d40d657a9b773dc1b3ecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-admin/syslog-ng/syslog-ng-3.0.4.ebuild,v 1.5 2009/10/30 11:04:45 maekke Exp $

EAPI=2
inherit fixheadtails eutils

MY_PV=${PV/_/}
DESCRIPTION="syslog replacement with advanced filtering features"
HOMEPAGE="http://www.balabit.com/products/syslog_ng/"
SRC_URI="http://www.balabit.com/downloads/files/syslog-ng/sources/${PV}/source/syslog-ng_${PV}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 ~arm hppa ~ia64 ~mips ppc ~ppc64 ~s390 ~sh ~sparc x86 ~x86-fbsd"
IUSE="caps ipv6 pcre selinux spoof-source sql ssl static tcpd"
RESTRICT="test"

LIBS_DEPEND="
	spoof-source? ( net-libs/libnet )
	ssl? ( dev-libs/openssl )
	tcpd? ( >=sys-apps/tcp-wrappers-7.6 )
	>=dev-libs/eventlog-0.2
	>=dev-libs/glib-2.10.1:2
	caps? ( sys-libs/libcap )
	sql? ( >=dev-db/libdbi-0.8.3 )"
RDEPEND="
	!static? (
		pcre? ( dev-libs/libpcre )
		${LIBS_DEPEND}
	)"
DEPEND="${RDEPEND}
	${LIBS_DEPEND}
	dev-util/pkgconfig
	sys-devel/flex"
PROVIDE="virtual/logger"

src_prepare() {
	ht_fix_file configure
}

src_configure() {
	local myconf

	if use static ; then
		myconf="${myconf} --enable-static-linking"
		if use pcre ; then
			ewarn "USE=pcre is incompatible with static linking"
			myconf="${myconf} --disable-pcre"
		fi
	else
			myconf="${myconf} --enable-dynamic-linking"
	fi
	econf \
		--disable-dependency-tracking \
		--sysconfdir=/etc/syslog-ng \
		--with-pidfile-dir=/var/run \
		$(use_enable caps linux-caps) \
		$(use_enable ipv6) \
		$(use_enable pcre) \
		$(use_enable spoof-source) \
		$(use_enable sql) \
		$(use_enable ssl) \
		$(use_enable tcpd tcp-wrapper) \
		${myconf}
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"

	dodoc AUTHORS ChangeLog NEWS README \
		doc/examples/{syslog-ng.conf.sample,syslog-ng.conf.solaris} \
		contrib/syslog-ng.conf* \
		contrib/syslog2ng # "${FILESDIR}/syslog-ng.conf."*
	dohtml doc/reference/syslog-ng.html/*

	newinitd ${FILESDIR}/syslog-ng.init syslog-ng

	insinto /etc/syslog-ng
	newins ${FILESDIR}/syslog-ng.conf-3.0 syslog-ng.conf

	insinto /etc/logrotate.d
	newins ${FILESDIR}/syslog-ng.logrotate syslog-ng
	diropts -m 0750 -o root -g adm
	dodir /var/log/syslog-ng.archive

	dodoc ${FILESDIR}/syslog-ng.remote.current.cron
}

pkg_postinst() {
	einfo
	einfo "The bundled syslog-ng.conf is prepared for being used"
	einfo "for standalone, logclient and logserver installations"
	einfo "(they can all be combined for one installation if desired)."
	einfo
	einfo "For standalone or logserver installations, local messages"
	einfo "should be logged to /var/log/messages (all messages)"
	einfo "and /var/log/syslog-ng/ (for application or facility based"
	einfo "logging) and be archived to /var/log/syslog-ng.archive/"
	einfo "using the bundled logrotate config snippet."
	einfo
	einfo "If you are using this installation for a logserver,"
	einfo "remote messages should be logged to a directory like"
	einfo "/var/log/syslog-ng.remote/YEAR/MONTH/DAY/HOSTNAME/"
	einfo "and NOT be rotated with logrotate (syslog-ng.conf has"
	einfo "an example on logging to such a destination)."
	einfo "You can use the included syslog-ng.remote.current.cron"
	einfo "to maintain a current symlink from 'current' to the"
	einfo "current YEAR/MONTH/DAY directory for convenience (makes"
	einfo "it easier to 'tail -f' or 'less +F' the current logfiles)."
	einfo "To do so, simply copy the cron script to /etc/cron.daily/."
	einfo "You might also want to have a look at stunnel for securely"
	einfo "tunneling remote log messages via SSL over TCP."
	einfo "I might add some stunnel sample configs to this package"
	einfo "in the future ;-)"
	einfo
	einfo "You might want to use app-admin/tenshi for monitoring"
	einfo "the logs. The bundled syslog-ng.conf is prepared for"
	einfo "logging messages to a dedicated fifo for tenshi, which"
	einfo "is believed to be the best solution available."
	einfo
	ewarn
	ewarn "ATTENTION: since version 2.0.1, the values of the"
	ewarn "           syslog-ng.conf options dir_owner(),"
	ewarn "           dir_group(), owner() and group()"
	ewarn "           MUST be quoted when they are a"
	ewarn "           string instead of a UID/GID!"
	ewarn
}