[syslog-ng] Localport() & localip() now working after patch
simonst at wellsfargo.com
simonst at wellsfargo.com
Tue Apr 3 22:15:42 CEST 2007
The patch for localip() & localport() worked - thanks! Here's those parms
in my working syslog-ng.conf:
# sed -n '/localip/,/}/p' /etc/syslog-ng/syslog-ng.conf
destination logger1 { tcp("10.11.12.13" port(5295) localip(10.9.8.7)
localport(syslog-ng)
template("$UNIXTIME $HOST $MESSAGE\n") ); };
destination logger2 { tcp("10.21.22.23" port(5295) localip(10.9.8.7)
localport(syslog-ng)
template("$UNIXTIME $HOST $MESSAGE\n") ); };
It's not a big deal to me, but it got errors (or warnings?) when I coded a
numeric port in localport():
# sed -n '/localip/,/}/p' syslog-ng.conf_NUMERIC
destination logger1 { tcp("10.11.12.13" port(5295) localip(10.9.8.7)
localport(5295)
template("$UNIXTIME $HOST $MESSAGE\n") ); };
destination logger2 { tcp("10.21.22.23" port(5295) localip(10.9.8.7)
localport(5295)
template("$UNIXTIME $HOST $MESSAGE\n") ); };
# syslog-ng -dFsf syslog-ng.conf_NUMERIC
Error finding port number, falling back to default; service='tcp/5295'
Error finding port number, falling back to default; service='tcp/5295'
----------------------------------------------------------------------------
---------------
I've committed the patch below. Can you check if this fixes it? It seems
to work well for me.
Thanks.
--- orig/src/cfg-grammar.y
+++ mod/src/cfg-grammar.y
@@ -375,14 +375,12 @@ source_afinet_udp_options
source_afinet_udp_option
: source_afinet_option
- | KW_LOCALPORT '(' string ')' {
afinet_sd_set_localport(last_driver, 0, $3, "udp"); free($3); }
- | KW_PORT '(' string ')' {
afinet_sd_set_localport(last_driver, 0, $3, "udp"); free($3); }
+ | KW_LOCALPORT '(' string_or_number ')' {
afinet_sd_set_localport(last_driver, 0, $3, "udp"); free($3); }
+ | KW_PORT '(' string_or_number ')' {
afinet_sd_set_localport(last_driver, 0, $3, "udp"); free($3); }
;
source_afinet_option
: KW_LOCALIP '(' string ')' {
afinet_sd_set_localip(last_driver, $3); free($3); }
- | KW_LOCALPORT '(' NUMBER ')' {
afinet_sd_set_localport(last_driver, $3, NULL, NULL); }
- | KW_PORT '(' NUMBER ')' {
afinet_sd_set_localport(last_driver, $3, NULL, NULL); }
| KW_IP '(' string ')' {
afinet_sd_set_localip(last_driver, $3); free($3); }
| source_reader_option
| inet_socket_option
@@ -407,8 +405,8 @@ source_afinet_tcp_options
source_afinet_tcp_option
: source_afinet_option
- | KW_LOCALPORT '(' string ')' {
afinet_sd_set_localport(last_driver, 0, $3, "tcp"); free($3); }
- | KW_PORT '(' string ')' {
afinet_sd_set_localport(last_driver, 0, $3, "tcp"); free($3); }
+ | KW_LOCALPORT '(' string_or_number ')' {
afinet_sd_set_localport(last_driver, 0, $3, "tcp"); free($3); }
+ | KW_PORT '(' string_or_number ')' {
afinet_sd_set_localport(last_driver, 0, $3, "tcp"); free($3); }
| source_afsocket_stream_params {}
;
@@ -602,16 +600,15 @@ dest_afinet_udp_options
dest_afinet_option
: KW_LOCALIP '(' string ')' {
afinet_dd_set_localip(last_driver, $3); free($3); }
- | KW_PORT '(' NUMBER ')' {
afinet_dd_set_destport(last_driver, $3, NULL, NULL); }
| inet_socket_option
| dest_writer_option
;
dest_afinet_udp_option
: dest_afinet_option
- | KW_LOCALPORT '(' string ')' {
afinet_dd_set_localport(last_driver, 0, $3, "udp"); free($3); }
- | KW_PORT '(' string ')' {
afinet_dd_set_destport(last_driver, 0, $3, "udp"); free($3); }
- | KW_DESTPORT '(' string ')' {
afinet_dd_set_destport(last_driver, 0, $3, "udp"); free($3); }
+ | KW_LOCALPORT '(' string_or_number ')' {
afinet_dd_set_localport(last_driver, 0, $3, "udp"); free($3); }
+ | KW_PORT '(' string_or_number ')' {
afinet_dd_set_destport(last_driver, 0, $3, "udp"); free($3); }
+ | KW_DESTPORT '(' string_or_number ')' {
afinet_dd_set_destport(last_driver, 0, $3, "udp"); free($3); }
| KW_SPOOF_SOURCE '(' yesno ')' {
afinet_dd_set_spoof_source(last_driver, $3); }
;
@@ -635,9 +632,9 @@ dest_afinet_tcp_options
dest_afinet_tcp_option
: dest_afinet_option
- | KW_LOCALPORT '(' string ')' {
afinet_dd_set_localport(last_driver, 0, $3, "tcp"); free($3); }
- | KW_PORT '(' string ')' {
afinet_dd_set_destport(last_driver, 0, $3, "tcp"); free($3); }
- | KW_DESTPORT '(' string ')' {
afinet_dd_set_destport(last_driver, 0, $3, "tcp"); free($3); }
+ | KW_LOCALPORT '(' string_or_number ')' {
afinet_dd_set_localport(last_driver, 0, $3, "tcp"); free($3); }
+ | KW_PORT '(' string_or_number ')' {
afinet_dd_set_destport(last_driver, 0, $3, "tcp"); free($3); }
+ | KW_DESTPORT '(' string_or_number ')' {
afinet_dd_set_destport(last_driver, 0, $3, "tcp"); free($3); }
/*
| KW_MAC '(' yesno ')'
| KW_AUTH '(' yesno ')'
--
Bazsi
_______________________________________________
syslog-ng maillist - syslog-ng at lists.balabit.hu
https://lists.balabit.hu/mailman/listinfo/syslog-ng
Frequently asked questions at http://www.campin.net/syslog-ng/faq.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5621 bytes
Desc: not available
Url : http://lists.balabit.hu/pipermail/syslog-ng/attachments/20070403/e5cb8d8b/smime-0001.bin
More information about the syslog-ng
mailing list