[syslog-ng]use_time_recvd
Trapp, Michael
michael.trapp@sap.com
Fri, 27 Sep 2002 11:51:09 +0200
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_000_01C2660B.67F33260
Content-Type: text/plain;
charset="iso-8859-1"
hi bazsi,
i was a little bit surprised about the use_time_recvd option.
obviously it has no impact on the timestamp of a recieved msg
if there is already a timestamp included.
i thought that the recvd-timestamp is used anyway ...
well, i've attached a patch to fix that.
regards
michael
------_=_NextPart_000_01C2660B.67F33260
Content-Type: application/octet-stream;
name="patch.use_time_recvd"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="patch.use_time_recvd"
Index: syslog-ng-1.5.20/src/afinet.c=0A=
diff -c syslog-ng-1.5.20/src/afinet.c:1.1 =
syslog-ng-1.5.20/src/afinet.c:1.2=0A=
*** syslog-ng-1.5.20/src/afinet.c:1.1 Fri Sep 27 11:33:56 2002=0A=
--- syslog-ng-1.5.20/src/afinet.c Fri Sep 27 11:36:17 2002=0A=
***************=0A=
*** 19,25 ****=0A=
*=0A=
* Inspired by nsyslog, originally written by Darren Reed.=0A=
*=0A=
! * $Id: afinet.c,v 1.1 2002/09/27 09:33:56 mt Exp $=0A=
*=0A=
=
************************************************************************=
***/=0A=
=0A=
--- 19,25 ----=0A=
*=0A=
* Inspired by nsyslog, originally written by Darren Reed.=0A=
*=0A=
! * $Id: afinet.c,v 1.2 2002/09/27 09:36:17 mt Exp $=0A=
*=0A=
=
************************************************************************=
***/=0A=
=0A=
***************=0A=
*** 89,101 ****=0A=
notice("AF_INET client connected from %S, port %i\n", =0A=
inet->ip, inet->port);=0A=
io_read(self->client, =0A=
! make_log_reader(0, NULL, cfg->log_msg_size, 0, cfg->check_hostname =
? LF_CHECK_HOSTNAME : 0, c), =0A=
make_afsocket_source_close_callback(self));=0A=
}=0A=
else {=0A=
/* SOCK_DGRAM */=0A=
io_read(self->client, =0A=
! make_log_reader(1, NULL, cfg->log_msg_size, 0, cfg->check_hostname =
? LF_CHECK_HOSTNAME : 0, c), =0A=
make_afsocket_source_close_callback(self));=0A=
}=0A=
=0A=
--- 89,105 ----=0A=
notice("AF_INET client connected from %S, port %i\n", =0A=
inet->ip, inet->port);=0A=
io_read(self->client, =0A=
! make_log_reader(0, NULL, cfg->log_msg_size, 0,=0A=
! ( cfg->check_hostname ? LF_CHECK_HOSTNAME : 0 ) |=0A=
! ( cfg->use_time_recvd ? LF_USE_TIME_RECVD : 0 ) , c), =0A=
make_afsocket_source_close_callback(self));=0A=
}=0A=
else {=0A=
/* SOCK_DGRAM */=0A=
io_read(self->client, =0A=
! make_log_reader(1, NULL, cfg->log_msg_size, 0,=0A=
! ( cfg->check_hostname ? LF_CHECK_HOSTNAME : 0 ) |=0A=
! ( cfg->use_time_recvd ? LF_USE_TIME_RECVD : 0 ) , c), =0A=
make_afsocket_source_close_callback(self));=0A=
}=0A=
=0A=
Index: syslog-ng-1.5.20/src/log.c=0A=
diff -c syslog-ng-1.5.20/src/log.c:1.1 =
syslog-ng-1.5.20/src/log.c:1.2=0A=
*** syslog-ng-1.5.20/src/log.c:1.1 Fri Sep 27 11:33:57 2002=0A=
--- syslog-ng-1.5.20/src/log.c Fri Sep 27 11:36:17 2002=0A=
***************=0A=
*** 19,25 ****=0A=
*=0A=
* Inspired by nsyslog, originally written by Darren Reed.=0A=
*=0A=
! * $Id: log.c,v 1.1 2002/09/27 09:33:57 mt Exp $=0A=
*=0A=
=
************************************************************************=
***/=0A=
=0A=
--- 19,25 ----=0A=
*=0A=
* Inspired by nsyslog, originally written by Darren Reed.=0A=
*=0A=
! * $Id: log.c,v 1.2 2002/09/27 09:36:17 mt Exp $=0A=
*=0A=
=
************************************************************************=
***/=0A=
=0A=
***************=0A=
*** 47,53 ****=0A=
int left;=0A=
int pri;=0A=
time_t now =3D time(NULL);=0A=
! char *oldsrc;=0A=
int oldleft;=0A=
=0A=
src =3D data;=0A=
--- 47,53 ----=0A=
int left;=0A=
int pri;=0A=
time_t now =3D time(NULL);=0A=
! char *oldsrc, ts[20];=0A=
int oldleft;=0A=
=0A=
src =3D data;=0A=
***************=0A=
*** 94,102 ****=0A=
src[9] =3D=3D ':' && src[12] =3D=3D ':') {=0A=
struct tm tm, *nowtm;=0A=
=0A=
! /* Just read the buffer data into a textual=0A=
! datestamp. */=0A=
! lm->date =3D c_format_cstring("%s", 15, src);=0A=
src +=3D 15;=0A=
left -=3D 15;=0A=
=0A=
--- 94,112 ----=0A=
src[9] =3D=3D ':' && src[12] =3D=3D ':') {=0A=
struct tm tm, *nowtm;=0A=
=0A=
! if (lm->flags & LF_USE_TIME_RECVD) {=0A=
! if (!(nowtm =3D localtime(now))) {=0A=
! lm->date =3D c_format("%i", lm->recvd);=0A=
! } else {=0A=
! strftime(ts, sizeof(ts) - 1, "%h %e %H:%M:%S", nowtm);=0A=
! ts[16] =3D '\0';=0A=
! lm->date =3D c_format("%z", ts);=0A=
! }=0A=
! } else {=0A=
! /* Just read the buffer data into a textual=0A=
! datestamp. */=0A=
! lm->date =3D c_format_cstring("%s", 15, src);=0A=
! }=0A=
src +=3D 15;=0A=
left -=3D 15;=0A=
=0A=
Index: syslog-ng-1.5.20/src/log.h=0A=
diff -c syslog-ng-1.5.20/src/log.h:1.1 =
syslog-ng-1.5.20/src/log.h:1.2=0A=
*** syslog-ng-1.5.20/src/log.h:1.1 Fri Sep 27 11:33:57 2002=0A=
--- syslog-ng-1.5.20/src/log.h Fri Sep 27 11:36:17 2002=0A=
***************=0A=
*** 19,25 ****=0A=
*=0A=
* Inspired by nsyslog, originally written by Darren Reed.=0A=
*=0A=
! * $Id: log.h,v 1.1 2002/09/27 09:33:57 mt Exp $=0A=
*=0A=
*********************************************************************=
******/=0A=
=0A=
--- 19,25 ----=0A=
*=0A=
* Inspired by nsyslog, originally written by Darren Reed.=0A=
*=0A=
! * $Id: log.h,v 1.2 2002/09/27 09:36:17 mt Exp $=0A=
*=0A=
=
************************************************************************=
***/=0A=
=0A=
***************=0A=
*** 57,62 ****=0A=
--- 57,63 ----=0A=
#define LF_MARK 0x0002=0A=
#define LF_LOCAL 0x0004=0A=
#define LF_CHECK_HOSTNAME 0x0100=0A=
+ #define LF_USE_TIME_RECVD 0x0200=0A=
=0A=
#define LF_USER_FLAGS 0xff00=0A=
=0A=
------_=_NextPart_000_01C2660B.67F33260--