[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ossec-dev] ossec-hids: logcollector.c (HEAD) main.c (HEAD) read_syslog.c (HEAD) [dcid]



Module name:	ossec-hids
Changes by:	dcid	06/09/09 17:06:54

Modified files:
	logcollector.c main.c read_syslog.c

Log message:
Description: Adding debug options to multiple daemons and more fixes for the win32 agent.
Reviewed by: dcid
Bug:

Index: logcollector.c
===================================================================
RCS file: /usr/cvsroot/ossec-hids/src/logcollector/logcollector.c,v
diff -u -r1.26 -r1.27
--- logcollector.c	7 Sep 2006 23:19:04 -0000	1.26
+++ logcollector.c	9 Sep 2006 20:06:53 -0000	1.27
@@ -35,6 +35,8 @@
     struct timeval fp_timeout;
     #endif
 
+    debug1("%s: DEBUG: Entering LogCollectorStart().", ARGV0);
+    
     /* Initializing each file and structure */
     for(i = 0;;i++)
     {
@@ -267,9 +269,17 @@
                 merror(LOGC_FILE_ERROR, ARGV0, logff[i].file);
                 if(logff[i].fp)
                     fclose(logff[i].fp);
+                    
                 logff[i].fp = NULL;
-                logff[i].ffile = NULL;
-                logff[i].file = NULL;
+
+
+                /* If the file has a variable date, ignore it for
+                 * today only.
+                 */
+                if(!logff[i].ffile)
+                {
+                    logff[i].file = NULL;
+                }
                 logff[i].ign = -10;
                 continue;
             }
@@ -328,6 +338,8 @@
 
         os_strdup(lfile, logff[i].file);    
 
+        verbose(VAR_LOG_MON, ARGV0, logff[i].file);
+        
         /* Setting cday to zero because other files may need
          * to be changed.
          */

Index: main.c
===================================================================
RCS file: /usr/cvsroot/ossec-hids/src/logcollector/main.c,v
diff -u -r1.15 -r1.16
--- main.c	4 Sep 2006 20:39:21 -0000	1.15
+++ main.c	9 Sep 2006 20:06:54 -0000	1.16
@@ -39,6 +39,7 @@
 int main(int argc, char **argv)
 {
     int c;
+    int debug_flag = 0;
     int test_config = 0;
     char *cfg = DEFAULTCPATH;
     char *dir = DEFAULTDIR;
@@ -92,7 +93,18 @@
     /* Getting loop timeout */
     loop_timeout = getDefine_Int("logcollector",
                                  "loop_timeout",
-                                 1, 120);        
+                                 1, 120);
+            
+    debug_flag = getDefine_Int("logcollector",
+                               "debug",
+                               0,2);
+    
+    /* Getting debug values */
+    while(debug_flag != 0)
+    {
+        nowDebug();
+        debug_flag--;
+    }
 
 
     /* Exit if test config */
@@ -124,6 +136,7 @@
    
    
     /* Waiting 6 seconds for the analysisd/agentd to settle */
+    debug1("%s: DEBUG: Waiting main daemons to settle.", ARGV0);
     sleep(6);
     
      

Index: read_syslog.c
===================================================================
RCS file: /usr/cvsroot/ossec-hids/src/logcollector/read_syslog.c,v
diff -u -r1.17 -r1.18
--- read_syslog.c	23 Jun 2006 19:21:41 -0000	1.17
+++ read_syslog.c	9 Sep 2006 20:06:54 -0000	1.18
@@ -55,7 +55,7 @@
         else
         {
             /* Message not complete. Return. */
-            /* merror("%s: Message not complete. Trying again: '%s'", ARGV0,str); */
+            debug1("%s: Message not complete. Trying again: '%s'", ARGV0,str);
             fsetpos(logff[pos].fp, &fp_pos);
             break;
         }    
@@ -74,6 +74,8 @@
         }
         #endif
                       
+        debug2("%s: DEBUG: Reading syslog message: '%s'", ARGV0, str);
+
         
         /* Sending message to queue */
         if(SendMSG(logr_queue,str,logff[pos].file,
@@ -89,7 +91,7 @@
         /* Incorrectly message size */
         if(__ms)
         {
-            merror("%s: Incorrect message size: '%s'", ARGV0, str);
+            merror("%s: Large message size: '%s'", ARGV0, str);
             while(fgets(str, OS_MAXSTR - 36, logff[pos].fp) != NULL)
             {
                 /* Getting the last occurence of \n */


OSSEC home | Main Index | Thread Index


OSSEC project: www.ossec.net.
Mailling list information: http://www.ossec.net/en/mailing_lists.html.