Hi, In order to make the transition to syslog-ng easier for people, I thought it might be useful to have an automated translation from the old syslog.conf to a working syslog-ng.conf. I came up with an awk script which works OK for me. I was targeting Solaris and AIX specifically, but off-hand, RedHat linux syslogd looks the same and I presume other UNIX variants' do, too. Try it, it could work ;) In particular, there are three things to look out for if you're interested in porting this to another UNIX platform: 1) Change the local log device if necessary, from /dev/log to whatever it's supposed to be. 2) Change the device type (i.e. the syslog-ng.conf directive) for the local log device. The script checks 'uname' for SunOS and AIX and sets an appropriate variable; just add to that detection mechanism. A variable would do nicely for the log device, too, but they've got the same name in AIX and Solaris so I didn't worry about it. (I'm not using the "door" device). 3) The script is an awk script, but its invoked by ksh. It's easy to rearrange it so that it's invoked directly as awk, but for what I plan to do with it, I didn't need that. In either case, ksh won't be available on many linux distros, I think, so just change the shell to bash or something. (In this case, I hope the shell you pick is lenient about newlines within a quoted command line argument!) Hope this is useful! -- Jonathan Marks Systems Administrator, Production Systems Group Computing and Communication Services Office University of Illinois at Urbana-Champaign
On Tue, May 01, 2001 at 06:01:41PM -0500, Jon Marks wrote:
Hi,
In order to make the transition to syslog-ng easier for people, I thought it might be useful to have an automated translation from the old syslog.conf to a working syslog-ng.conf. I came up with an awk script which works OK for me. I was targeting Solaris and AIX specifically, but off-hand, RedHat linux syslogd looks the same and I presume other UNIX variants' do, too. Try it, it could work ;)
In particular, there are three things to look out for if you're interested in porting this to another UNIX platform:
1) Change the local log device if necessary, from /dev/log to whatever it's supposed to be.
2) Change the device type (i.e. the syslog-ng.conf directive) for the local log device. The script checks 'uname' for SunOS and AIX and sets an appropriate variable; just add to that detection mechanism. A variable would do nicely for the log device, too, but they've got the same name in AIX and Solaris so I didn't worry about it. (I'm not using the "door" device).
3) The script is an awk script, but its invoked by ksh. It's easy to rearrange it so that it's invoked directly as awk, but for what I plan to do with it, I didn't need that. In either case, ksh won't be available on many linux distros, I think, so just change the shell to bash or something. (In this case, I hope the shell you pick is lenient about newlines within a quoted command line argument!)
I'd add this script to the contrib subdirectory if you don't mind. -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
Great! I hope it's useful for people. I've made a few changes that might make it a little better. I've cleaned it up a bit, making it work more intuitively (I've only just picked up awk). It also now does the translation in the same order as the statements in syslog.conf, outputting a commented out version of the translated line before each translation. I fixed an inaccuracy in the translation which would have occurred if the same output destination is used twice in syslog.conf. I added log-device sensitivity for Linux. And finally, I added some comments to make it easier to understand. On Wed, May 02, 2001 at 11:47:49AM +0200, Balazs Scheidler wrote:
On Tue, May 01, 2001 at 06:01:41PM -0500, Jon Marks wrote:
Hi,
In order to make the transition to syslog-ng easier for people, I thought it might be useful to have an automated translation from the old syslog.conf to a working syslog-ng.conf. I came up with an awk script which works OK for me. I was targeting Solaris and AIX specifically, but off-hand, RedHat linux syslogd looks the same and I presume other UNIX variants' do, too. Try it, it could work ;)
I'd add this script to the contrib subdirectory if you don't mind.
-- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
_______________________________________________ syslog-ng maillist - syslog-ng@lists.balabit.hu https://lists.balabit.hu/mailman/listinfo/syslog-ng
-- Jonathan Marks Systems Administrator, Production Systems Group Computing and Communication Services Office University of Illinois at Urbana-Champaign
Hi, I've tried out the copy of the awk script syslog2ng incorporated into the development branch contrib directory-- but it won't run. It's a parse error that only seems to crop up when awk is fed this program on its stdin, but not as a command line argument. I'm still not sure why it doesn't work-- what about its parsing would change using -f? Any seasoned awk programmers out there want to help out? I'm grateful for any advice! It's always the same syntactic construct that causes the error: BEGIN { # Handle the various platforms- determine proper log device "/bin/uname -s" | getline sysname; # <-- ERROR HERE!! close("/bin/uname -s"); Thanks! On Wed, May 02, 2001 at 11:47:49AM +0200, Balazs Scheidler wrote:
On Tue, May 01, 2001 at 06:01:41PM -0500, Jon Marks wrote:
Hi,
In order to make the transition to syslog-ng easier for people, I thought it might be useful to have an automated translation from the old syslog.conf to a working syslog-ng.conf. I came up with an awk script which works OK for me. I was targeting Solaris and AIX specifically, but off-hand, RedHat linux syslogd looks the same and I presume other UNIX variants' do, too. Try it, it could work ;)
In particular, there are three things to look out for if you're interested in porting this to another UNIX platform:
1) Change the local log device if necessary, from /dev/log to whatever it's supposed to be.
2) Change the device type (i.e. the syslog-ng.conf directive) for the local log device. The script checks 'uname' for SunOS and AIX and sets an appropriate variable; just add to that detection mechanism. A variable would do nicely for the log device, too, but they've got the same name in AIX and Solaris so I didn't worry about it. (I'm not using the "door" device).
3) The script is an awk script, but its invoked by ksh. It's easy to rearrange it so that it's invoked directly as awk, but for what I plan to do with it, I didn't need that. In either case, ksh won't be available on many linux distros, I think, so just change the shell to bash or something. (In this case, I hope the shell you pick is lenient about newlines within a quoted command line argument!)
I'd add this script to the contrib subdirectory if you don't mind.
-- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
_______________________________________________ syslog-ng maillist - syslog-ng@lists.balabit.hu https://lists.balabit.hu/mailman/listinfo/syslog-ng
-- Jonathan Marks Systems Administrator, Production Systems Group Computing and Communication Services Office University of Illinois at Urbana-Champaign
On Fri, May 04, 2001 at 05:31:11PM -0500, Jon Marks wrote:
Hi,
I've tried out the copy of the awk script syslog2ng incorporated into the development branch contrib directory-- but it won't run. It's a parse error that only seems to crop up when awk is fed this program on its stdin, but not as a command line argument. I'm still not sure why it doesn't work-- what about its parsing would change using -f? Any seasoned awk programmers out there want to help out? I'm grateful for any advice! It's always the same syntactic construct that causes the error:
BEGIN { # Handle the various platforms- determine proper log device "/bin/uname -s" | getline sysname; # <-- ERROR HERE!! close("/bin/uname -s");
I'm no AWK expert, so I can't solve your problem, I just wanted to add that it does run on Linux. (Debian potato) -- Bazsi PGP info: KeyID 9AF8D0A9 Fingerprint CD27 CFB0 802C 0944 9CFD 804E C82C 8EB1
participants (2)
-
Balazs Scheidler
-
Jon Marks