diff options
-rw-r--r-- | lib/snmp/doc/src/notes.xml | 13 | ||||
-rw-r--r-- | lib/snmp/src/app/snmp.appup.src | 30 | ||||
-rw-r--r-- | lib/snmp/src/misc/snmp_log.erl | 50 | ||||
-rw-r--r-- | lib/snmp/src/misc/snmp_verbosity.erl | 2 |
4 files changed, 54 insertions, 41 deletions
diff --git a/lib/snmp/doc/src/notes.xml b/lib/snmp/doc/src/notes.xml index 8320b8762e..2350c0947e 100644 --- a/lib/snmp/doc/src/notes.xml +++ b/lib/snmp/doc/src/notes.xml @@ -72,8 +72,19 @@ --> <list type="bulleted"> + <item> + <p>Loosing log entries when converting a large Audit Trail Log. </p> + <p>When converting an entire Audit Trail Log in a running + system its possble to have log wraps and thereby loosing log + entries. </p> + <p>In order to prevent this the log is now blocked + during conversion (<c>log_to_txt</c> or <c>log_to_io</c>). </p> + <p>Own Id: OTP-11396</p> + <p>Own Id: seq12433</p> + </item> + <item> - <p>When converting an Audit Trail Log to text a corrupt + <p>When converting the Audit Trail Log to text a corrupt log entry could cause the entire conversion to fail. </p> <p>Also, for a log with sequence numbers, failing to decode a log entry would cause the conversion to fail diff --git a/lib/snmp/src/app/snmp.appup.src b/lib/snmp/src/app/snmp.appup.src index daf8496670..31f56cb73c 100644 --- a/lib/snmp/src/app/snmp.appup.src +++ b/lib/snmp/src/app/snmp.appup.src @@ -36,10 +36,9 @@ }, {"4.22", [ + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmp_log, soft_purge, soft_purge, - [snmp_verbosity]}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmp_pdus, soft_purge, soft_purge, []}, {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []} @@ -90,8 +89,8 @@ {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, {load_module, snmpa, soft_purge, soft_purge, [snmp]}, {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, - {load_module, snmp_verbosity, soft_purge, soft_purge, [snmp_verbosity]}, + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, {update, snmpa_local_db, soft, soft_purge, soft_purge, []}, @@ -341,10 +340,9 @@ }, {"4.22", [ + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, + {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm, soft_purge, soft_purge, []}, - {load_module, snmp_log, soft_purge, soft_purge, - [snmp_verbosity]}, - {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmp_pdus, soft_purge, soft_purge, []}, {load_module, snmp_view_based_acm_mib, soft_purge, soft_purge, []}, {load_module, snmp_user_based_sm_mib, soft_purge, soft_purge, []} @@ -368,7 +366,7 @@ {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, {load_module, snmpa, soft_purge, soft_purge, [snmp]}, {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, @@ -396,7 +394,7 @@ {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, {load_module, snmpa, soft_purge, soft_purge, [snmp]}, {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, @@ -422,7 +420,7 @@ {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, @@ -454,7 +452,7 @@ {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, @@ -490,7 +488,7 @@ {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, @@ -526,7 +524,7 @@ {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, @@ -564,7 +562,7 @@ {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, @@ -603,7 +601,7 @@ {load_module, snmp, soft_purge, soft_purge, [snmp_log]}, {load_module, snmpm, soft_purge, soft_purge, [snmp]}, - {load_module, snmp_log, soft_purge, soft_purge, []}, + {load_module, snmp_log, soft_purge, soft_purge, [snmp_verbosity]}, {load_module, snmp_verbosity, soft_purge, soft_purge, []}, {load_module, snmpm_mpd, soft_purge, soft_purge, []}, diff --git a/lib/snmp/src/misc/snmp_log.erl b/lib/snmp/src/misc/snmp_log.erl index a365e8c8ed..1aba3b56f8 100644 --- a/lib/snmp/src/misc/snmp_log.erl +++ b/lib/snmp/src/misc/snmp_log.erl @@ -444,25 +444,23 @@ log_convert(Log, File, Converter) -> do_log_convert(Log, File, Converter). do_log_convert(Log, File, Converter) -> - ?vtrace("do_log_converter -> entry with" - "~n Log: ~p" - "~n File: ~p", [Log, File]), - Verbosity = get(verbosity), + %% ?vtrace("do_log_converter -> entry with" + %% "~n Log: ~p" + %% "~n File: ~p", [Log, File]), + Verbosity = get(verbosity), {Pid, Ref} = erlang:spawn_monitor( fun() -> - put(sname, "LOG-CONVERTER"), - put(verbosity, Verbosity), - erlang:process_flag(trap_exit, true), - ?vlog("begin converting", []), + put(sname, lc), + put(verbosity, Verbosity), Result = do_log_convert2(Log, File, Converter), - ?vlog("convert result: ~p", [Result]), + %% ?vlog("convert result: ~p", [Result]), exit(Result) end), receive {'DOWN', Ref, process, Pid, Result} -> - ?vtrace("do_log_converter -> received result" - "~n Result: ~p", [Result]), + %% ?vtrace("do_log_converter -> received result" + %% "~n Result: ~p", [Result]), Result end. @@ -473,28 +471,32 @@ do_log_convert2(Log, File, Converter) -> ?vtrace("do_log_convert2 -> entry - check if owner", []), case is_owner(Log) of true -> - ?vtrace("do_log_convert2 -> owner - now convert", []), - Converter(Log); + ?vdebug("do_log_converter2 -> owner - now convert log", []), + disk_log:block(Log, true), + Res = Converter(Log), + disk_log:unblock(Log), + Res; false -> %% Not yet member of the ruling party, apply for membership... - ?vtrace("do_log_convert2 -> not owner - open", []), + ?vtrace("do_log_converter2 -> not owner - open log", []), case log_open(Log, File) of {ok, _} -> - ?vdebug("do_log_convert2 -> opened - now convert", []), + ?vdebug("do_log_convert2 -> opened - now convert log", []), + disk_log:block(Log, true), Res = Converter(Log), - ?vtrace("do_log_convert2 -> converted - now close", []), + disk_log:unblock(Log), disk_log:close(Log), - ?vtrace("do_log_convert2 -> closed - done", []), Res; {error, {name_already_open, _}} -> ?vdebug("do_log_convert2 -> " - "already opened - now convert", []), - Res = Converter(Log), - ?vtrace("do_log_convert2 -> converted - done", []), + "already opened - now convert log", []), + disk_log:block(Log, true), + Res = Converter(Log), + disk_log:unblock(Log), Res; {error, Reason} -> - ?vinfo("do_log_convert2 -> failed open: " - "~n Reason: ~p", [Reason]), + ?vinfo("Failed converting log - open failed: " + "~n Reason: ~p", [Reason]), {error, {Log, Reason}} end end. @@ -536,9 +538,9 @@ do_log_to_file(Log, TextFile, Mibs, Start, Stop) -> ?vtrace("do_log_to_txt -> done", []), Res; {error, Reason} -> - ?vinfo("failed opening output file: " + ?vinfo("Failed opening output file: " "~n TestFile: ~p" - "~n Reason: ~p", [TextFile, Reason]), + "~n Reason: ~p", [TextFile, Reason]), {error, {TextFile, Reason}} end. diff --git a/lib/snmp/src/misc/snmp_verbosity.erl b/lib/snmp/src/misc/snmp_verbosity.erl index 8c4fe3fcb0..7d063fd702 100644 --- a/lib/snmp/src/misc/snmp_verbosity.erl +++ b/lib/snmp/src/misc/snmp_verbosity.erl @@ -148,6 +148,8 @@ image_of_sname(mnifl) -> "M-NET-IF-LOGGER"; image_of_sname(mnifw) -> io_lib:format("M-NET-IF-worker(~p)", [self()]); image_of_sname(mconf) -> "M-CONF"; +image_of_sname(lc) -> io_lib:format("LOG-CONVERTER(~p)", [self()]); + image_of_sname(mgr) -> "MGR"; image_of_sname(mgr_misc) -> "MGR_MISC"; |