]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
STABLE14-auditlog-include-timestamp-20050710 openafs-devel-1_3_85
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 11 Jul 2005 23:13:39 +0000 (23:13 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 11 Jul 2005 23:13:39 +0000 (23:13 +0000)
add a timestamp to auditlog

(cherry picked from commit 855d3669b28707afd8f9fe59d2a857eafb0552af)

src/audit/audit.c

index 99533f43e4238daf7526df19f0e189a0155132aa..93c4ba6efec2483101d0a055c6a371233279e033 100644 (file)
@@ -148,10 +148,21 @@ printbuf(FILE *out, int rec, char *audEvent, afs_int32 errCode, va_list vaList)
     struct AFSCBFids *vaFids;
     int num = LogThreadNum();
     struct in_addr hostAddr;
-
-    /* Don't print the thread id if we recursed */
-    if ((num > -1) && (rec == 0))
-       fprintf(out, "[%d]:", num);
+    time_t currenttime;
+    char *timeStamp;
+    char tbuffer[26];
+    
+    /* Don't print the timestamp or thread id if we recursed */
+    if (rec == 0) {
+       currenttime = time(0);
+       timeStamp = afs_ctime(&currenttime, tbuffer,
+                             sizeof(tbuffer));
+       timeStamp[24] = ' ';   /* ts[24] is the newline, 25 is the null */
+       fprintf(out, timeStamp);
+
+       if (num > -1)
+           fprintf(out, "[%d] ", num);
+    }
     
     if (strcmp(audEvent, "VALST") != 0)
        fprintf(out,  "EVENT %s CODE %d ", audEvent, errCode);