1 | # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 |
---|
2 | # $Id$ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | |
---|
6 | PortGroup perl5 1.0 |
---|
7 | |
---|
8 | name elsa |
---|
9 | version |
---|
10 | categories sysutils security |
---|
11 | platforms darwin |
---|
12 | maintainers yahoo.fr:jul_bsd openmaintainer |
---|
13 | license GPL-2 |
---|
14 | |
---|
15 | description Enterprise log search and archive (ELSA) is an \ |
---|
16 | industrial-strength solution for centralized log management. |
---|
17 | |
---|
18 | long_description ELSA is a centralized syslog framework built on \ |
---|
19 | Syslog-NG, MySQL, and Sphinx full-text search. It \ |
---|
20 | provides a fully asynchronous web-based query \ |
---|
21 | interface that normalizes logs and makes \ |
---|
22 | searching billions of them for arbitrary strings \ |
---|
23 | as easy as searching the web. It also includes \ |
---|
24 | tools for assigning permissions for viewing the \ |
---|
25 | logs as well as email based alerts, scheduled \ |
---|
26 | queries, and graphing. |
---|
27 | |
---|
28 | homepage https://code.google.com/p/enterprise-log-search-and-archive/ |
---|
29 | |
---|
30 | add_users elsa group=elsa home=${prefix}/var/db/elsa shell=/sbin/nologin realname=elsa\ user |
---|
31 | |
---|
32 | use_configure no |
---|
33 | build {} |
---|
34 | |
---|
35 | ## in future, move nodedir to normal tree and webdir to prefix/www ? |
---|
36 | set elsadir ${prefix}/share/elsa |
---|
37 | set etcdir ${prefix}/etc/elsa |
---|
38 | set nodedir ${elsadir}/node |
---|
39 | set webdir ${elsadir}/web |
---|
40 | |
---|
41 | ## destroot??? default prefix is /usr/local/elsa |
---|
42 | ## FIXME! No Makefile, no support for DESTDIR |
---|
43 | destroot.asroot yes |
---|
44 | destroot { |
---|
45 | xinstall -d ${destroot}${elsadir} |
---|
46 | foreach file [glob -directory ${worksrcpath} *] { |
---|
47 | copy ${file} ${destroot}${elsadir} |
---|
48 | } |
---|
49 | } |
---|
50 | |
---|
51 | post-destroot { |
---|
52 | |
---|
53 | xinstall -d -u elsa -g elsa ${destroot}${prefix}/var/log/${name} |
---|
54 | xinstall -d -u elsa -g elsa ${destroot}${elsadir}/tmp |
---|
55 | |
---|
56 | ## node |
---|
57 | xinstall -d -u elsa -g elsa ${destroot}${nodedir}/tmp/locks |
---|
58 | touch ${destroot}${nodedir}/tmp/locks/directory |
---|
59 | touch ${destroot}${nodedir}/tmp/locks/query |
---|
60 | xinstall -d -u elsa -g elsa ${destroot}${prefix}/var/db/elsa-sphinx/log |
---|
61 | xinstall -d ${destroot}${etcdir}/patterns.d |
---|
62 | xinstall -d -u elsa -g elsa ${destroot}${prefix}/var/db/elsa/tmp/buffers |
---|
63 | destroot.keepdirs \ |
---|
64 | ${destroot}${prefix}/var/log/${name} \ |
---|
65 | ${destroot}${nodedir}/tmp/locks \ |
---|
66 | ${destroot}${prefix}/var/db/elsa-sphinx/log \ |
---|
67 | ${destroot}${etcdir}/patterns.d \ |
---|
68 | ${destroot}${elsadir}/tmp \ |
---|
69 | ${destroot}${prefix}/var/db/elsa/tmp/buffers |
---|
70 | #ln -s ${prefix}/var/log/${name} ${destroot}${elsadir}/log |
---|
71 | |
---|
72 | xinstall -d ${destroot}${prefix}/share/examples/${name} |
---|
73 | copy ${filespath}/sphinx.conf.default-elsa ${destroot}${prefix}/share/examples/${name} |
---|
74 | move ${destroot}${elsadir}/contrib ${destroot}${prefix}/share/examples/${name}/ |
---|
75 | reinplace "s|/usr/bin/env perl|${prefix}/bin/perl5.16 -w|" \ |
---|
76 | ${destroot}${prefix}/share/examples/${name}/contrib/validate_config.pl |
---|
77 | reinplace "s|/usr/local/elsa/web/conf/elsa.conf|${etcdir}/elsa_web.conf|" \ |
---|
78 | ${destroot}${prefix}/share/examples/${name}/contrib/validate_config.pl |
---|
79 | reinplace "s|/usr/local/elsa/node/elsa.conf|${etcdir}/elsa_node.conf|" \ |
---|
80 | ${destroot}${prefix}/share/examples/${name}/contrib/validate_config.pl |
---|
81 | ## FIXME! better way to chmod this file ? |
---|
82 | system "chmod 755 ${destroot}${prefix}/share/examples/${name}/contrib/validate_config.pl" |
---|
83 | move ${destroot}${nodedir}/conf/elsa.conf ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
84 | copy ${destroot}${prefix}/share/examples/${name}/elsa_node.conf ${destroot}${prefix}/share/examples/${name}/elsa_node.conf.pristine |
---|
85 | reinplace "s|/usr/local/elsa|${elsadir}|" \ |
---|
86 | ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
87 | reinplace "s|/usr/local/sphinx/bin/indexer|${prefix}/bin/indexer|" \ |
---|
88 | ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
89 | reinplace "s|/usr/local/etc/sphinx.conf|${prefix}/etc/sphinx/sphinx.conf|" \ |
---|
90 | ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
91 | reinplace "s|/data/sphinx|${prefix}/var/db/elsa-sphinx/sphinx.conf|" \ |
---|
92 | ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
93 | reinplace "s|/usr/local/etc/sphinx_stopwords.txt|${prefix}/etc/sphinx/sphinx_stopwords.txt|" \ |
---|
94 | ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
95 | reinplace "s|/var/run/searchd.pid|${prefix}/var/run/searchd.pid|" \ |
---|
96 | ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
97 | reinplace "s|/data/elsa/log|${prefix}/var/log/elsa|" \ |
---|
98 | ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
99 | reinplace "s|/data/elsa/mysql|${prefix}/var/db/elsa/mysql|" \ |
---|
100 | ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
101 | reinplace "s|/data/elsa/tmp/buffers|${prefix}/var/db/elsa/tmp/buffers|" \ |
---|
102 | ${destroot}${prefix}/share/examples/${name}/elsa_node.conf |
---|
103 | move ${destroot}${nodedir}/conf/stopwords.txt ${destroot}${prefix}/share/examples/${name}/sphinx_stopwords.txt |
---|
104 | move ${destroot}${nodedir}/conf/patterndb.xml ${destroot}${prefix}/share/examples/${name}/ |
---|
105 | move ${destroot}${nodedir}/conf/syslog-ng.conf ${destroot}${prefix}/share/examples/${name}/syslog-ng-elsa.conf |
---|
106 | #move ${destroot}${nodedir}/conf/sphinx.conf.template ${destroot}${prefix}/share/examples/${name}/node-sphinx.conf.template |
---|
107 | |
---|
108 | ## web |
---|
109 | move ${destroot}${webdir}/conf/apache_site.conf ${destroot}${prefix}/share/examples/${name}/apache-elsa.conf |
---|
110 | reinplace "s|/usr/local/elsa/web|${webdir}|" \ |
---|
111 | ${destroot}${prefix}/share/examples/${name}/apache-elsa.conf |
---|
112 | reinplace "s|/etc/elsa_web.conf|${etcdir}/elsa_web.conf|" \ |
---|
113 | ${destroot}${prefix}/share/examples/${name}/apache-elsa.conf |
---|
114 | reinplace "s|:80|:8080|" \ |
---|
115 | ${destroot}${prefix}/share/examples/${name}/apache-elsa.conf |
---|
116 | reinplace "s|'/etc/elsa_node.conf'|'${etcdir}/elsa_node.conf'|" \ |
---|
117 | ${destroot}${nodedir}/elsa.pl |
---|
118 | |
---|
119 | ## both |
---|
120 | xinstall -d ${destroot}${prefix}/share/doc/${name} |
---|
121 | move ${worksrcpath}/README ${destroot}${prefix}/share/doc/${name}/ |
---|
122 | move ${worksrcpath}/INSTALL ${destroot}${prefix}/share/doc/${name}/ |
---|
123 | move ${worksrcpath}/LICENSE ${destroot}${prefix}/share/doc/${name}/ |
---|
124 | } |
---|
125 | |
---|
126 | post-activate { |
---|
127 | ## node |
---|
128 | if ![file exists ${nodedir}/conf/elsa.conf ] { |
---|
129 | copy ${prefix}/share/examples/${name}/elsa_node.conf ${nodedir}/conf/ |
---|
130 | ln -s ${nodedir}/conf/elsa_node.conf ${etcdir}/ |
---|
131 | } |
---|
132 | if ![file exists ${etcdir}/patterns.d/patterndb.xml ] { |
---|
133 | copy ${prefix}/share/examples/${name}/patterndb.xml ${etcdir}/patterns.d/ |
---|
134 | } |
---|
135 | if ![file exists ${prefix}/etc/syslog-ng-elsa.conf ] { |
---|
136 | copy ${prefix}/share/examples/${name}/syslog-ng-elsa.conf ${prefix}/etc/ |
---|
137 | } |
---|
138 | if ![file exists ${prefix}/etc/sphinx/sphinx_stopwords.txt ] { |
---|
139 | copy ${prefix}/share/examples/${name}/sphinx_stopwords.txt ${prefix}/etc/sphinx/ |
---|
140 | } |
---|
141 | |
---|
142 | ## web |
---|
143 | if { ! [file exists ${prefix}/apache2/conf/extra/apache-elsa.conf ] && [file exists ${prefix}/apache2/conf/extra] } { |
---|
144 | copy ${prefix}/share/examples/${name}/apache-elsa.conf ${prefix}/apache2/conf/extra/ |
---|
145 | } |
---|
146 | # if { ! [file exists ${prefix}/etc/nginx/nginx-elsa.conf ] && [file exists ${prefix}/etc/nginx] } { |
---|
147 | # copy ${prefix}/share/examples/${name}/nginx-elsa.conf ${prefix}/etc/nginx/ |
---|
148 | # } |
---|
149 | |
---|
150 | } |
---|
151 | if {${subport} eq ${name}} { |
---|
152 | # master_sites http://enterprise-log-search-and-archive.googlecode.com/svn/trunk/elsa/contrib/ |
---|
153 | # distname install.sh |
---|
154 | # extract.suffix |
---|
155 | # checksums rmd160 e4bd14146878ccdfe8c45f770a07b3cacafbc841 \ |
---|
156 | # sha256 716b773ec6c28767610c1032f3bb310b0ec01ddffbe8968efa89b21e460a006e |
---|
157 | # extract { |
---|
158 | # worksrcdir . |
---|
159 | # copy ${distpath}/install.sh ${worksrcpath}/ |
---|
160 | # } |
---|
161 | |
---|
162 | fetch.type svn |
---|
163 | svn.url http://enterprise-log-search-and-archive.googlecode.com/svn/trunk/ |
---|
164 | version 20140717 |
---|
165 | svn.revision 1205 |
---|
166 | worksrcdir trunk/elsa |
---|
167 | |
---|
168 | } |
---|
169 | |
---|
170 | subport ${name}-node { |
---|
171 | fetch.type svn |
---|
172 | svn.url http://enterprise-log-search-and-archive.googlecode.com/svn/trunk/ |
---|
173 | version 20140717 |
---|
174 | svn.revision 1205 |
---|
175 | worksrcdir trunk/elsa |
---|
176 | } |
---|
177 | |
---|
178 | subport ${name}-web { |
---|
179 | fetch.type svn |
---|
180 | svn.url http://enterprise-log-search-and-archive.googlecode.com/svn/trunk/ |
---|
181 | version 20140717 |
---|
182 | svn.revision 1205 |
---|
183 | worksrcdir trunk/elsa |
---|
184 | } |
---|
185 | |
---|
186 | depends_lib port:libgeoip port:libnet11 port:pkgconfig port:glib2 \ |
---|
187 | port:pcre port:libpcap port:openssl \ |
---|
188 | port:sphinx |
---|
189 | ## psgi, plack ? |
---|
190 | #depends_run port:curl port:subversion port:syslog-ng port:wget port:eventlog |
---|
191 | depends_run port:curl port:subversion port:wget port:eventlog |
---|
192 | |
---|
193 | ## reviewed INSTALL, install.sh |
---|
194 | notes " |
---|
195 | 1) need to setup web server, Mysql and other required daemons |
---|
196 | - If Apache w modrewrite |
---|
197 | (if not existing, file automatically created) |
---|
198 | $ sudo cp ${prefix}/share/examples/${name}/apache-elsa.conf ${prefix}/apache2/conf/extra/ |
---|
199 | add an \"Include ${prefix}/apache2/conf/extra/elsa.conf\" to your httpd.conf |
---|
200 | - If Nginx (Not supported currently) |
---|
201 | - Mysql5X |
---|
202 | $ mysqladmin5 -u root -p create syslog |
---|
203 | $ mysqladmin5 -u root -p create syslog_data |
---|
204 | $ mysql5 -u root -p syslog < ${nodedir}/conf/schema.sql |
---|
205 | $ mysqladmin5 -u root -p create syslog_web |
---|
206 | $ mysql5 -u root -p syslog_web < ${webdir}/conf/meta_db_schema.mysql |
---|
207 | mysql> GRANT ALL ON syslog.* to elsa@localhost; |
---|
208 | mysql> GRANT ALL ON syslog_data.* to elsa@localhost; |
---|
209 | mysql> SET PASSWORD FOR elsa@localhost = PASSWORD('biglog'); |
---|
210 | mysql> flush privileges; |
---|
211 | - Sphinx w variant ?mysql5x for ELSA for data in ${prefix}/var/db/elsa-sphinx |
---|
212 | $ sudo cp ${prefix}/share/examples/${name}/sphinx.conf.default-elsa ${prefix}/etc/sphinx/sphinx.conf |
---|
213 | OR |
---|
214 | $ touch ${elsadir}/log/web.log |
---|
215 | $ chown <webuser> ${elsadir}/log/web.log |
---|
216 | $ ${prefix}/share/examples/${name}/contrib/validate_config.pl |
---|
217 | $ echo \"\" | sudo ${prefix}/bin/perl5X \"${nodedir}/elsa.pl\" -on -c ${etcdir}/elsa.conf (NOK) |
---|
218 | (will not create config if file ${prefix}/etc/sphinx/sphinx.conf exists) |
---|
219 | - Syslog-ng |
---|
220 | (if not existing, file automatically created) |
---|
221 | $ sudo cp ${prefix}/share/examples/${name}/syslog-ng.conf ${prefix}/etc/syslog-ng-elsa.conf |
---|
222 | # echo \"@include \"${prefix}/etc/syslog-ng-elsa.conf\"\" >> ${prefix}/etc/syslog-ng.conf |
---|
223 | Validate config |
---|
224 | # syslog-ng -s -f /opt/local/etc/syslog-ng.conf |
---|
225 | - others |
---|
226 | $ sudo mkfifo -m 666 ${elsadir}/tmp/realtime |
---|
227 | $ sudo mkfifo -m 666 ${elsadir}/tmp/import |
---|
228 | |
---|
229 | 2) Check all daemons are started: sphinx searchd syslog-ng |
---|
230 | FIXME! nothing for sphinx |
---|
231 | $ sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.syslogd.plist |
---|
232 | $ sudo launchctl load -w /Library/LaunchDaemons/org.macports.syslog-ng.plist |
---|
233 | $ sudo launchctl load -w /Library/LaunchDaemons/org.macports.sphinx.plist (FIXME) |
---|
234 | $ sudo launchctl load -w /Library/LaunchDaemons/org.macports.elsa.plist (FIXME) |
---|
235 | |
---|
236 | 3) Test log messages to elsa node |
---|
237 | $ loggen -Di -I 1 127.0.0.1 514 |
---|
238 | " |
---|
239 | |
---|
240 | perl5.branches 5.16 5.18 5.20 |
---|
241 | perl5.default_branch 5.20 |
---|
242 | perl5.create_variants ${perl5.branches} |
---|
243 | |
---|
244 | ## Missing? Plack::Handler::Apache2 |
---|
245 | depends_lib-append port:perl${perl5.major} \ |
---|
246 | port:p${perl5.major}-module-build \ |
---|
247 | port:p${perl5.major}-extutils-makemaker \ |
---|
248 | port:p${perl5.major}-test-simple \ |
---|
249 | port:p${perl5.major}-dbd-mysql \ |
---|
250 | port:p${perl5.major}-time-hires \ |
---|
251 | port:p${perl5.major}-cgi \ |
---|
252 | port:p${perl5.major}-moose \ |
---|
253 | port:p${perl5.major}-sys-meminfo \ |
---|
254 | port:p${perl5.major}-app-cpanminus \ |
---|
255 | port:p${perl5.major}-sys-info \ |
---|
256 | port:p${perl5.major}-sys-info-driver-osx \ |
---|
257 | port:p${perl5.major}-sys-info-driver-unknown \ |
---|
258 | port:p${perl5.major}-json-xs \ |
---|
259 | port:p${perl5.major}-config-json \ |
---|
260 | port:p${perl5.major}-string-crc32 \ |
---|
261 | port:p${perl5.major}-log-log4perl \ |
---|
262 | port:p${perl5.major}-moosex-traits \ |
---|
263 | port:p${perl5.major}-datetime-format-strptime \ |
---|
264 | port:p${perl5.major}-storable \ |
---|
265 | port:p${perl5.major}-json \ |
---|
266 | port:p${perl5.major}-net-openssh \ |
---|
267 | port:p${perl5.major}-module-pluggable \ |
---|
268 | port:p${perl5.major}-libwww-perl \ |
---|
269 | port:p${perl5.major}-plack \ |
---|
270 | port:p${perl5.major}-digest-md5 \ |
---|
271 | port:p${perl5.major}-archive-zip \ |
---|
272 | port:p${perl5.major}-apache-admin-config \ |
---|
273 | port:p${perl5.major}-digest-sha \ |
---|
274 | port:p${perl5.major}-moosex-log-log4perl \ |
---|
275 | port:p${perl5.major}-log-log4perl-appender-socket-unix \ |
---|
276 | port:p${perl5.major}-sys-info-base \ |
---|
277 | port:p${perl5.major}-capture-tiny |
---|
278 | |
---|
279 | livecheck.type none |
---|