From f801470fa59886c1d1a0686ca17795fe40f73451 Mon Sep 17 00:00:00 2001 From: Timothy Stack Date: Tue, 9 Jul 2013 06:51:18 -0700 Subject: [PATCH] [log format] more log formats --- src/default-log-formats.json | 64 ++++++++++++++++++++++++++++++++++++ src/lnav_util.cc | 2 ++ src/log_format_impls.cc | 6 ++-- test/Makefile.am | 1 + test/Makefile.in | 1 + 5 files changed, 71 insertions(+), 3 deletions(-) diff --git a/src/default-log-formats.json b/src/default-log-formats.json index 8cd57a2f..3b285727 100644 --- a/src/default-log-formats.json +++ b/src/default-log-formats.json @@ -88,6 +88,54 @@ } ] }, + "error_log" : { + "regex" : [ + "^(?\\w) \\[(?\\d{2}/\\w{3}/\\d{4}:\\d{2}:\\d{2}:\\d{2}) [\\w\\-\\+]+\\] (?.*)" + ], + "level-field": "level", + "level" : { + "error" : "E", + "warning" : "W", + "info" : "I" + } + }, + "page_log" : { + "regex" : [ + "^(?[\\w_\\-\\.]+) (?[\\w\\.\\-]+) (?\\d+) \\[(?\\d{2}/\\w{3}/\\d{4}:\\d{2}:\\d{2}:\\d{2}) [\\w\\-\\+]+\\] (?total|\\d+) (?\\d+) (?[^ ]+) (?[\\w\\.\\-]+)\\s*(?.*)?" + ], + "value" : { + "printer" : { + "kind" : "string", + "identifier" : true + }, + "username" : { + "kind" : "string", + "identifier" : true + }, + "job_id" : { + "kind" : "integer", + "identifier" : true + }, + "page_number" : { + "kind" : "string" + }, + "copies" : { + "kind" : "integer" + }, + "billing" : { + "kind" : "string", + "identifier" : true + }, + "hostname" : { + "kind" : "string", + "identifier" : true + }, + "title" : { + "kind" : "string", + "identifier" : true + } + } + }, "vmw_log" : { "regex" : ["^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z) \\[(?<tid>\\w+) (?<level>\\w+) '(?<comp>[^']+)'(?: opID=(?<opid>[^ \\]]+))?(?: user=(?<user>[\\w\\-]+))?\\](?<body>.*)$"], "level-field": "level", @@ -168,6 +216,22 @@ } ] }, + "block_log" : { + "regex" : [ + "^(?<timestamp>\\w{3} \\w{3}\\s+\\d{1,2} \\d{2}:\\d{2}:\\d{2} \\w+ \\d{4})$" + ] + }, + "fsck_hfs_log" : { + "regex" : [ + "^(?<device>[^:]+): fsck_hfs run at (?<timestamp>\\w{3} \\w{3}\\s+\\d{1,2} \\d{2}:\\d{2}:\\d{2} \\d{4})" + ], + "value" : { + "device" : { + "kind" : "string", + "identifier" : true + } + } + }, "snaplogic_log" : { "regex" : ["^(?<timestamp>\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?) (?:(?:(?<level>\\w+) (?<logger>[^ ]+) (?<facility>[^ ]+) (?<msgid>[^ ]+) (?<pipe_rid>[^ \\.]+)(?:\\.(?<comp_rid>[^ ]+))? (?<resource_name>[^ ]+) (?<invoker>[^ ]+))|(?:stdout: ))(?<body>.*)"], "level-field" : "level", diff --git a/src/lnav_util.cc b/src/lnav_util.cc index ba85874a..53f2636d 100644 --- a/src/lnav_util.cc +++ b/src/lnav_util.cc @@ -241,6 +241,8 @@ const char *std_time_fmt[] = { "%b %d %H:%M:%S", + "%m/%d/%y %H:%M:%S", + NULL, }; diff --git a/src/log_format_impls.cc b/src/log_format_impls.cc index 1192e4f4..a446b861 100644 --- a/src/log_format_impls.cc +++ b/src/log_format_impls.cc @@ -137,9 +137,9 @@ class generic_log_format : public log_format { static const char *log_fmt[] = { "%63[0-9TZ: ,.-]%63[^:]%n", "%63[a-zA-Z0-9:-+/.] [%*x %63[^\n]%n", - "%63[a-zA-Z0-9:.,-] %63[^\n]%n", - "%63[a-zA-Z0-9: .,-] [%*[^]]]%63[^:]%n", - "%63[a-zA-Z0-9: .,-] %63[^\n]%n", + "%63[a-zA-Z0-9:.,-/] %63[^\n]%n", + "%63[a-zA-Z0-9: .,-/] [%*[^]]]%63[^:]%n", + "%63[a-zA-Z0-9: .,-/] %63[^\n]%n", "[%63[0-9: .-] %*s %63[^\n]%n", "[%63[a-zA-Z0-9: -+/]] %63[^\n]%n", "[%63[a-zA-Z0-9: -+/]] [%63[a-zA-Z]]%n", diff --git a/test/Makefile.am b/test/Makefile.am index e8a44ff7..0fef11d1 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -168,6 +168,7 @@ dist_noinst_SCRIPTS = \ test_listview.sh \ test_logfile.sh \ test_sql_coll_func.sh \ + test_sql_str_func.sh \ test_sql_fs_func.sh \ test_view_colors.sh \ test_vt52_curses.sh diff --git a/test/Makefile.in b/test/Makefile.in index b81ad4b9..21b08529 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -753,6 +753,7 @@ dist_noinst_SCRIPTS = \ test_listview.sh \ test_logfile.sh \ test_sql_coll_func.sh \ + test_sql_str_func.sh \ test_sql_fs_func.sh \ test_view_colors.sh \ test_vt52_curses.sh