Browse Source

Merge "Parse message logs containining timestamps with microseconds"

Zuul 6 months ago
parent
commit
4ab53a4e7a
1 changed files with 10 additions and 0 deletions
  1. 10
    0
      oslogmerger/oslogmerger.py

+ 10
- 0
oslogmerger/oslogmerger.py View File

@@ -156,6 +156,11 @@ class MsgLogParser(StrptimeParser):
156 156
         return dt.replace(self.year), dt_str, data
157 157
 
158 158
 
159
+class MsgLogWithMicrosecondsParser(MsgLogParser):
160
+    """Message format: Mar 13 15:19:08.525234"""
161
+    date_format = '%b %d %H:%M:%S.%f'
162
+
163
+
159 164
 def make_tzinfo(name, sign, hours, minutes):
160 165
     tzoffset = int(minutes) * 60 + int(hours) * 3600
161 166
     if sign == '-':
@@ -439,6 +444,7 @@ LOG_TYPES = {
439 444
     'logfiles_detect': None,
440 445
     'logfiles_o': OSLogParser,
441 446
     'logfiles_m': MsgLogParser,
447
+    'logfiles_ms': MsgLogWithMicrosecondsParser,
442 448
     'logfiles_t': TSLogParser,
443 449
 }
444 450
 
@@ -759,6 +765,10 @@ one has not been provided:'
759 765
     parser.add_argument('--msg-logs', '-ml', default=[], nargs='+',
760 766
                         dest='logfiles_m', metavar='file[:ALIAS]',
761 767
                         help='Message log files with format: Oct 15 14:11:19')
768
+    parser.add_argument('--msg-logs-ms', '-ms', default=[], nargs='+',
769
+                        dest='logfiles_ms', metavar='file[:ALIAS]',
770
+                        help='Message log files with format: '
771
+                             'Mar 13 15:19:08.525234')
762 772
     parser.add_argument('--timestamp-logs', '-tl', default=[], nargs='+',
763 773
                         dest='logfiles_t', metavar='file[:ALIAS]',
764 774
                         help='Message log files with timestamp: [   0.003036]')

Loading…
Cancel
Save