んで早速 http://www.balabit.com/downloads/syslog-ng/ から最新の安定版を落として中身を見てみるとspecファイルがあったので、とりあえず何もいじらずrpmbuild -bbしてみたところ
Making all in src
make[1]: ディレクトリ `/tmp/syslog-ng-1.5.26/src' に入ります
make all-recursive
make[2]: ディレクトリ `/tmp/syslog-ng-1.5.26/src' に入ります
Making all in .
make[3]: ディレクトリ `/tmp/syslog-ng-1.5.26/src' に入ります
gcc -DHAVE_CONFIG_H -I. -I/tmp/syslog-ng-1.5.26/src -I. -g
-O2 -Wall -D_GNU_SOURCE -c main.c
In file included from main.c:26:
syslog-ng.h:31:21: objects.h: そのようなファイルやディレクトリはありません
In file included from cfgfile.h:29,
from main.c:27:
sources.h:30:23: read_line.h: そのようなファイルやディレクトリはありません
In file included from sources.h:32,
from cfgfile.h:29,
from main.c:27:
log.h:30:16: io.h: そのようなファイルやディレクトリはありません
In file included from cfgfile.h:29,
from main.c:27:
sources.h:33:18: list.h: そのようなファイルやディレクトリはありません
main.c:29:20: format.h: そのようなファイルやディレクトリはありません
main.c:30:20: werror.h: そのようなファイルやディレクトリはありません
main.c:31:19: queue.h: そのようなファイルやディレクトリはありません
main.c:32:24: pkt_buffer.h: そのようなファイルやディレクトリはありません
make[3]: *** [main.o] エラー 1
make[3]: ディレクトリ `/tmp/syslog-ng-1.5.26/src' から出ます
make[2]: *** [all-recursive] エラー 1
make[2]: ディレクトリ `/tmp/syslog-ng-1.5.26/src' から出ます
make[1]: *** [all-recursive-am] エラー 2
make[1]: ディレクトリ `/tmp/syslog-ng-1.5.26/src' から出ます
make: *** [all-recursive] エラー 1
ダメじゃん(;´д`)ノおかしいなぁといろいろ調べていると・・・
syslog-ngパッケージは libol に依存するので、syslog-ngよりも前にlibolをインストールしておく必要がある
なんで、今度は http://www.balabit.hu/downloads/syslog-ng/libol/ から最新版を落として展開。
同じくspecがあったので何も考えずにrpmbuild -bbすると
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/libol-root
error: Installed (but unpackaged) file(s) found:
/usr/local/bin/make_class
RPM build errors:
Installed (but unpackaged) file(s) found:
/usr/local/bin/make_class
どうにもspecファイルでmake_classが記載されていないようなので%filesの項目(47行目辺り)に/usr/local/bin/make_classを追加したら無事rpmが作れました。んで、作成したRPMのうちlibol本体とlibol-develをインストールして、suslog-ngのrpmbuildを試したら今度はあっさり成功( ̄▽ ̄)ノ
そのまま普通にインストールしました。
で、次に設定ですがサンプルがsyslog-ngのtarボールの中に入っているcontribディレクトリの中にありますが、そのままじゃちゃんと動かないので下に修正版を載せてみました。
# ${prifix}/etc/syslog-ng/syslog-ng.conf
options { sync (0);
time_reopen (10);
log_fifo_size (1000);
long_hostnames (off);
use_dns (no);
use_fqdn (no);
create_dirs (no);
keep_hostname (yes);
stats(86400);
};
source s_sys { pipe ("/proc/kmsg" log_prefix("kernel: ")); unix-stream ("/dev/log"); internal(); };
destination d_cons { file("/dev/console"); };
destination d_mesg { file("/var/log/messages"); };
destination d_auth { file("/var/log/secure"); };
destination d_mail { file("/var/log/maillog"); };
destination d_spol { file("/var/log/spooler"); };
destination d_boot { file("/var/log/boot.log"); };
destination d_cron { file("/var/log/cron"); };
destination d_mlal { usertty("*"); };
filter f_cons { level(warn..emerg) and facility(kern); };
filter f_mesg { level(info..emerg) and
not (facility(mail)
or facility(authpriv) or facility(cron)); };
filter f_auth { facility(authpriv); };
filter f_mail { facility(mail); };
filter f_mlal { level(emerg); };
filter f_spol { facility(uucp) or
(facility(news) and level(crit..emerg)); };
filter f_boot { facility(local7); };
filter f_cron { facility(cron); };
log { source(s_sys); filter(f_cons); destination(d_cons); };
log { source(s_sys); filter(f_mesg); destination(d_mesg); };
log { source(s_sys); filter(f_auth); destination(d_auth); };
log { source(s_sys); filter(f_mail); destination(d_mail); };
log { source(s_sys); filter(f_mlal); destination(d_mlal); };
log { source(s_sys); filter(f_spol); destination(d_spol); };
log { source(s_sys); filter(f_boot); destination(d_boot); };
log { source(s_sys); filter(f_cron); destination(d_cron); };
(なおlevelについてはサンプルではsyslogでの「level(info)」と「*.info」(プライオリティがinfo以上)が等価のようにかかれていますが、実際は「*.=info」と等価(つまりプライオリティがinfoしか記録しない)なので、syslogで「*.info」と同等の動作の為にはlevel(crit..emerg)というような表現が必要になります)これでデフォルトでsyslogと同じような動作をするように設定されてますが、自分でsyslogの設定をいじっている人はそれに併せて適宜変更してください
あと、設定ファイルを配置する場所はconfigureで変更してなければ「/usr/etc/syslog-ng/syslog-ng.conf」になります。
(気に入らない場合はspecでconfigure時に--sysconfdir=/etcをオプションとして渡してください)
それから自動起動もsyslog-ngのtarボールの中に入っているcontribディレクトリの中にサンプルがあるので、
# vi init.d.RedHat-7.3で、自動起動するようになります。
1行目に「#!/bin/sh」を追記
# cp init.d.RedHat-7.3 /etc/init.d/syslog-ng
# chmod 755 /etc/init.d/syslog-ng
# chkconfig --add syslog-ng
# chkconfig syslog off
最後に実際に起動してみましょう。
# /etc/init.d/syslog stop[OK]がでてちゃんと起動すれば、無事切り替え完了です( ̄▽ ̄)ノ
# /etc/init.d/syslog-ng start
ただ、長くなったんでswatchとの切り替えについてはまた後日
あと、ログを回すのにlogroutatedを使っている人はこちらも参照の事。
Posted by Takuchan at 2003年12月04日 00:53
| トラックバック(2)
OSは何をお使いですか?
エラーを見る限りchkconfigが修正した起動用ファイルをきちんと認識してないようですので、違うOS(またはバージョン)ならそのOS用のファイルを元に修正してください。
Posted by: Takuchan at 2004年06月25日 10:50はじめまして、早速ですが。
RedHat9にsyslog-ngをインストールしました。
今後はこのマシンでLAN上にあるPCのログを収拾させたいと思っています。
いわゆる「ログホスト」です。
Q1) 任意の受信したいHOST(IP)を追加するには?
Q2)HOST(IP)毎にファイルを分けるには?
以上、よろしくお願い致します。
>以上、よろしくお願い致します。
ここはサポセンではありません。
http://www.infoscience.co.jp/technical/press/app06.html
上記の内容を良く読んで自分で設定してください。
ちなみに、どちらも簡単に実現できます。