Daemontools-0.76 versiyonu için oldukça faydalı bir patch bulunmaktadır.
Zamanında enderUNIX ekibi tarafından hazırlanmış, fakat kullanım bakımından yaygınlaşmamıştır.
daemontools-0.76 patch öncesi log çıktı bu şekilde vermektedir.
@400000005d7d049938035cf4 tcpserver: status: 1/10
@400000005d7d0499380a7174 tcpserver: pid 4454 from 124.232.133.206
@400000005d7d0499380e2e7c tcpserver: ok 4454 0:185.44.192.228:25 :124.232.133.206::7262
@400000005d7d04a838f98c64 GREETDELAY from 124.232.133.206: client disconnected
@400000005d7d04a838fd0ed4 tcpserver: end 4454 status 256
@400000005d7d04a838fd225c tcpserver: status: 0/10
daemontools-0.76 versiyona patch geçildikten sonra bu şekilde çıktı üretmektedir.
2019-09-14T23:30:18 tcpserver: status: 1/10
2019-09-14T23:30:18 tcpserver: pid 28978 from 124.232.133.206
2019-09-14T23:30:18 tcpserver: ok 28978 0:185.44.192.228:25 :124.232.133.206::7368
2019-09-14T23:30:33 GREETDELAY from 124.232.133.206: client disconnected
2019-09-14T23:30:33 tcpserver: end 28978 status 256
2019-09-14T23:30:33 tcpserver: status: 0/10
oldukça anlaşılır hale gelmiş oldu.
daemontools-0.76-localtime.patch
diff -ruN daemontools-0.76.orig/src/multilog.c daemontools-0.76/src/multilog.c
--- daemontools-0.76.orig/src/multilog.c 2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/multilog.c 2009-12-19 02:52:09.000000000 +0200
@@ -514,7 +514,8 @@
}
if (!linelen)
if (flagtimestamp) {
- timestamp(line);
+ /* timestamp(line); */
+ timestamplocal(line);
line[25] = ' ';
linelen = 26;
}
diff -ruN daemontools-0.76.orig/src/timestamp.c daemontools-0.76/src/timestamp.c
--- daemontools-0.76.orig/src/timestamp.c 2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/timestamp.c 2009-12-19 02:53:02.000000000 +0200
@@ -1,7 +1,13 @@
+#include <sys/types.h>
+#include <time.h>
+#include <sys/time.h>
+#include <unistd.h>
#include "taia.h"
#include "timestamp.h"
static char hex[16] = "0123456789abcdef";
+time_t lt;
+struct tm *t;
void timestamp(char s[TIMESTAMP])
{
@@ -18,3 +24,11 @@
s[i * 2 + 2] = hex[nowpack[i] & 15];
}
}
+
+void timestamplocal(char s[TIMESTAMP])
+{
+ lt = time(NULL);
+ t = localtime(<);
+ asctime_r(t, s);
+ s[24] = ' ';
+}
diff -ruN daemontools-0.76.orig/src/timestamp.h daemontools-0.76/src/timestamp.h
--- daemontools-0.76.orig/src/timestamp.h 2001-07-12 19:49:49.000000000 +0300
+++ daemontools-0.76/src/timestamp.h 2009-12-19 02:52:17.000000000 +0200
@@ -4,5 +4,6 @@
#define TIMESTAMP 25
extern void timestamp(char *);
+extern void timestamplocal(char *);
#endif
Kaynakça:
https://web.archive.org/web/20120530042154/http://blog.endersys.com/tag/qmail/
Yorum Gönder