Roberto-- Good work. A couple notes-- * If one changes the --cfgfile option, then the svc.method file should be updated as well (it checks for the config file)... * We use the convention /etc/syslog-ng/ -> /usr/local/etc here; If my memory serves correctly, I ran into a small issue between the builds (maybe it was sunfreeware and a compiled build?). In any event, the link was an easy workaround to make sure syslog-ng starts up (with a config file). * The other thing is, logrotation may need to be updated (logadm.conf) : /var/log/syslog -C 8 -P 'Sat May 28 08:10:00 2005' -a 'kill -HUP `cat /var/run/syslog.pid`' /var/adm/messages -C 4 -P 'Sat May 28 08:10:00 2005' -a 'kill -HUP `cat /var/run/syslog.pid`' to /var/log/syslog -C 8 -P 'Sat May 28 08:10:00 2005' -a '/usr/sbin/svcadm refresh syslog-ng`' /var/adm/messages -C 4 -P 'Sat May 28 08:10:00 2005' -a '/usr/sbin/svcadm refresh syslog-ng`' ----- I'm not sure why Sun doesn't use svcadm to -HUP syslog... It should be noted, that feature with smf (as Sun touts as automatic healing) is that if you `pkill -9 syslog-ng` smf will :respawn: a new syslog-ng process. On 6/2/05, Roberto Nibali <ratz@tac.ch> wrote:
Hello,
Thanks for the excellent write-up.
After playing around with syslog-ng on Solaris 10 today, here are some notes: * As mentioned from Kenneth G, libol / syslog-ng should compile fine on Solaris 10, just make sure --enable-full-dynamic" in your configure for syslog-ng. * You may also need to update your LD_LIBRARY_PATH and PATH (/usr/sfw & /opt/sfw ? ) * Service Management Facility ("svcs" "svcadm" "svccfg" commands) You can choose to run syslog-ng via the traditional /etc/init.d method on solaris 10 and then wrap that start and stop script with the solaris 10's smf facility, or the other option is to do everything via the SMF facility. I've attached two files to do the later.
The example files assume your syslog-ng.conf is ln /etc/syslog-ng/ -> /usr/local/etc/syslog-ng/ and the binary is /usr/local/sbin/syslog-ng: 1) Compile and install libol, syslog-ng. 2) mkdir /usr/local/etc/syslog-ng; ln -s /usr/local/etc/syslog-ng /etc/syslog-ng
You don't really need the symlink, just submit the config file using --cfgfile upon invocation of syslog-ng.
3) copy your syslog-ng.conf to /etc/syslog-ng/ 4) cp svc.method.syslog-ng /lib/svc/method/syslog-ng 5) cp svc.manifest.syslog-ng.xml /var/svc/manifest/system/syslog-ng.xml 6) `svccfg import /var/svc/manifest/system/syslog-ng.xml`
Then to switch from standard syslog to syslog-ng: 1) svcadm disable system-log 2) svcadm enable syslog-ng
To revert back to solaris 10's default syslog, and have it running on reboot: 1) `svcadm disable syslog-ng` 2) `svccfg delete syslog-ng` 3) `svcadm enable system-log`
So why not make it a package then? You basically provided all the files and also the knowledge needed to create a package. The addition to the hybrid Makefile could be something along the lines of (schematically):
------------------------------------------------------------------ PKGDIR = /var/spool/pkg
package: stamp_build @echo "\n\tYou can ignore the warnings from pkgmk\n" cd pkg; pkgmk -od ${PKGDIR} @pkgname=syslog-ng cd ${PKGDIR}; tar cf - $$pkgname | compress > $${pkgname}.tar.Z rm -rf $$pkgname
stamp_build: configure cd distrib; make touch $@
config: configure configure: cd distrib; ./configure touch $@
clean: \rm -f stamp_* cd distrib; make distclean ------------------------------------------------------------------
In the pkg subdir of the syslog-ng tar ball we could put the following files:
## ## pkg/protoype ## i postinstall i preremove
!search ../misc ../distrib/ ../distrib/doc
d none /etc ? ? ? d none /usr ? ? ? d none /usr/local ? ? ? d none /usr/local/sbin ? ? ? d none /usr/share ? ? ? d none /usr/share/man ? ? ? # [a lot more entries]
!default 0755 sbin sbin f none /usr/local/sbin/syslog-ng # [a lot more entries]
------------
## ## pkg/preremove ## #!/bin/sh
echo "Warning: syslog-ng will be removed" # here a kill of the syslog-ng process should be placed svcadm enable system-log
------------
## ## pkg/postinstall ## # provided we have cp svc.method.syslog-ng in /lib/svc/method/syslog-ng # and svc.manifest.syslog-ng.xml in /var/svc/manifest/system/syslog-ng.xml svccfg import /var/svc/manifest/system/syslog-ng.xml svcadm disable system-log svcadm enable syslog-ng
So syslog-ng would be a hybrid package.
Best regards, Roberto Nibali, ratz -- ------------------------------------------------------------- addr://Rathausgasse 31, CH-5001 Aarau tel://++41 62 823 9355 http://www.terreactive.com fax://++41 62 823 9356 ------------------------------------------------------------- terreActive AG Wir sichern Ihren Erfolg -------------------------------------------------------------