Adjusted date expression for apahce error log
authorArjen Baart <arjen@andromeda.nl>
Sun, 13 Sep 2020 08:25:47 +0000 (10:25 +0200)
committerArjen Baart <arjen@andromeda.nl>
Sun, 13 Sep 2020 08:25:47 +0000 (10:25 +0200)
src/gcm_input/error_cooker.cpp
src/gcm_input/message.cpp

index 4311414..63fa891 100644 (file)
@@ -50,8 +50,8 @@
 
 #include "error_cooker.h"
 
-static const String unix_date_re("[[:alpha:]]{3} [[:alpha:]]{3} [ 123][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}");
-static const regex re_errorlog("^\\[" + unix_date_re + "\\] \\[(error|notice|warn|info)\\] .+");
+static const String unix_date_re("[[:alpha:]]{3} [[:alpha:]]{3} [ 0123][0-9] [0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)? [0-9]{4}");
+static const regex re_errorlog("^\\[" + unix_date_re + "\\] \\[.*(error|notice|warn|info|debug)\\] .+");
 
 bool error_cooker::check_pattern(String logline)
 {
index 185fa0e..9e761b5 100644 (file)
@@ -540,6 +540,11 @@ void client_message::enterXML()
                         }
                         log_service = pan.lc->service();
                         log_date    = pan.lc->timestamp();
+
+                        if (!log_date.proper())
+                        {
+                           *Log << log_date << " is not a valid timestamp.\n";
+                        }
                      }
                      else
                      {
@@ -634,6 +639,10 @@ void client_message::enterXML()
                   }
 
                }
+               else
+               {
+                  *Log << "Can not insert log element " << raw << ".\n";
+               }
  
             }
             node = node->next;