X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=perl%2FAmanda%2FLogfile.pm;h=8a18a8e4778c4def2cea99d44666890c9e57ff68;hb=b116e9366c7b2ea2c2eb53b0a13df4090e176235;hp=4bec9e9c52465eaa9efc958c79ba9b06b322ad41;hpb=fb2bd066c2f8b34addafe48d62550e3033a59431;p=debian%2Famanda diff --git a/perl/Amanda/Logfile.pm b/perl/Amanda/Logfile.pm index 4bec9e9..8a18a8e 100644 --- a/perl/Amanda/Logfile.pm +++ b/perl/Amanda/Logfile.pm @@ -1,17 +1,17 @@ # This file was automatically generated by SWIG (http://www.swig.org). -# Version 1.3.33 +# Version 1.3.39 # -# Don't modify this file, modify the SWIG interface instead. +# Do not make changes to this file unless you know what you are doing--modify +# the SWIG interface file instead. package Amanda::Logfile; -require Exporter; -require DynaLoader; -@ISA = qw(Exporter DynaLoader); +use base qw(Exporter); +use base qw(DynaLoader); require Amanda::Cmdline; package Amanda::Logfilec; bootstrap Amanda::Logfile; package Amanda::Logfile; -@EXPORT = qw( ); +@EXPORT = qw(); # ---------- BASE METHODS ------------- @@ -53,10 +53,18 @@ package Amanda::Logfile; *open_logfile = *Amanda::Logfilec::open_logfile; *close_logfile = *Amanda::Logfilec::close_logfile; *get_logline = *Amanda::Logfilec::get_logline; +*log_add = *Amanda::Logfilec::log_add; +*log_add_full = *Amanda::Logfilec::log_add_full; +*log_rename = *Amanda::Logfilec::log_rename; *find_log = *Amanda::Logfilec::find_log; *search_logfile = *Amanda::Logfilec::search_logfile; +*search_holding_disk = *Amanda::Logfilec::search_holding_disk; *dumps_match = *Amanda::Logfilec::dumps_match; *dumps_match_dumpspecs = *Amanda::Logfilec::dumps_match_dumpspecs; +*match_host = *Amanda::Logfilec::match_host; +*match_disk = *Amanda::Logfilec::match_disk; +*match_datestamp = *Amanda::Logfilec::match_datestamp; +*match_level = *Amanda::Logfilec::match_level; ############# Class : Amanda::Logfile::find_result_t ############## @@ -78,6 +86,8 @@ sub DESTROY { *swig_timestamp_get = *Amanda::Logfilec::find_result_t_timestamp_get; *swig_timestamp_set = *Amanda::Logfilec::find_result_t_timestamp_set; +*swig_write_timestamp_get = *Amanda::Logfilec::find_result_t_write_timestamp_get; +*swig_write_timestamp_set = *Amanda::Logfilec::find_result_t_write_timestamp_set; *swig_hostname_get = *Amanda::Logfilec::find_result_t_hostname_get; *swig_hostname_set = *Amanda::Logfilec::find_result_t_hostname_set; *swig_diskname_get = *Amanda::Logfilec::find_result_t_diskname_get; @@ -90,8 +100,20 @@ sub DESTROY { *swig_filenum_set = *Amanda::Logfilec::find_result_t_filenum_set; *swig_status_get = *Amanda::Logfilec::find_result_t_status_get; *swig_status_set = *Amanda::Logfilec::find_result_t_status_set; +*swig_dump_status_get = *Amanda::Logfilec::find_result_t_dump_status_get; +*swig_dump_status_set = *Amanda::Logfilec::find_result_t_dump_status_set; +*swig_message_get = *Amanda::Logfilec::find_result_t_message_get; +*swig_message_set = *Amanda::Logfilec::find_result_t_message_set; *swig_partnum_get = *Amanda::Logfilec::find_result_t_partnum_get; *swig_partnum_set = *Amanda::Logfilec::find_result_t_partnum_set; +*swig_totalparts_get = *Amanda::Logfilec::find_result_t_totalparts_get; +*swig_totalparts_set = *Amanda::Logfilec::find_result_t_totalparts_set; +*swig_sec_get = *Amanda::Logfilec::find_result_t_sec_get; +*swig_sec_set = *Amanda::Logfilec::find_result_t_sec_set; +*swig_kb_get = *Amanda::Logfilec::find_result_t_kb_get; +*swig_kb_set = *Amanda::Logfilec::find_result_t_kb_set; +*swig_orig_kb_get = *Amanda::Logfilec::find_result_t_orig_kb_get; +*swig_orig_kb_set = *Amanda::Logfilec::find_result_t_orig_kb_set; sub new { my $pkg = shift; my $self = Amanda::Logfilec::new_find_result_t(@_); @@ -144,17 +166,24 @@ package Amanda::Logfile; *P_CHUNKER = *Amanda::Logfilec::P_CHUNKER; *P_TAPER = *Amanda::Logfilec::P_TAPER; *P_AMFLUSH = *Amanda::Logfilec::P_AMFLUSH; +*P_AMDUMP = *Amanda::Logfilec::P_AMDUMP; +*P_AMIDXTAPED = *Amanda::Logfilec::P_AMIDXTAPED; +*P_AMFETCHDUMP = *Amanda::Logfilec::P_AMFETCHDUMP; +*P_AMCHECKDUMP = *Amanda::Logfilec::P_AMCHECKDUMP; +*P_AMVAULT = *Amanda::Logfilec::P_AMVAULT; +*amanda_log_trace_log = *Amanda::Logfilec::amanda_log_trace_log; @EXPORT_OK = (); %EXPORT_TAGS = (); + =head1 NAME Amanda::Logfile - manage Amanda trace logs =head1 SYNOPSIS - use Amanda::Logfile qw(:logtype_t); # XXX change + use Amanda::Logfile qw( :constants ); use Amanda::Config qw( :getconf config_dir_relative ); for my $logfile (Amanda::Logfile::find_log()) { @@ -167,9 +196,9 @@ Amanda::Logfile - manage Amanda trace logs print "Found info line from $pname: $str\n"; } } - Amanda::Logfile::close_logfile($log); + Amanda::Logfile::close_logfile($hdl); - my @dumps = Amanda::Logfile::search_logfile("TapeLabel-001", "19780615", $logfile); + my @dumps = Amanda::Logfile::search_logfile("TapeLabel-001", "19780615", $logfile, 1); my @matching = Amanda::Logfile::dumps_match([@dumps], "myhost", "/usr", undef, undef, 0); for my $dump (@matching) { @@ -177,32 +206,31 @@ Amanda::Logfile - manage Amanda trace logs } } -=head1 API STATUS - -Stabilizing - =head1 RAW LOGFILE ACCESS -This section corresponds to the C C module. +This section corresponds to the C C module. Raw access to logfiles is accomplished by opening a logfile and fetching log lines one by one via the C function. -A log line is represented by a list C<($type, $prog, $string)> -where C<$type> is one of the C constants (available in export -tag C), C<$prog> is one of the C constants (available -in export tag C), and C<$str> is the remainder of the line. - -Both families of constants can be converted to symbolic names with -C and C, respectively. +A log line is represented by a list C<($type, $prog, $string)> where C<$type> +is one of the C constants (available in export tag C), C<$prog> +is one of the C constants (available in export tag C), and +C<$str> is the remainder of the line. Both sets of constants are also available +in the usual C export tag. Both families of constants can be +converted to symbolic names with C and +C, respectively. =head2 FUNCTIONS +Use these functions to read a logfile: + =over =item C -Opens a logfile for reading, returning an opaque log file handle. +Opens a logfile for reading, returning an opaque log file +handle. Returns C and sets C<$!> on failure. =item C @@ -210,38 +238,77 @@ Closes a log file handle. =item C -Return a list as described above representing the next log line in -C<$handle>, or nothing at the end of the logfile. +Returns a list as described above representing the next log line in +C<$handle>, or nothing at the end of the logfile. =back -All of these functions can be imported by name if desired. +=head3 Writing a "current" Logfile + +To write a logfile, call C. On the first call, +this function opens and locks C<$logdir/log>; subsequent calls just append to +this file. As such, this function is only appropriate for situations where +C will be invoked later to rename C<$logdir/log> to +C<$logdir/log.$timestamp.$n>. + +If you need to write a log entry for another program, for example to simulate +taper entries, call C. + +All of the functions in this section can be imported by name if +desired. + +=head3 Utilities -=head1 Amanda::Find::find_result_t objects +Many trace log entries have a statistics entry in what used to be the error +message slot, of the form C<[sec .. kb .. kps ..]>. The function C +will create such an entry for you: + + make_stats($size, $duration, $orig_kb); + +Note that C<$orig_kb> can be undefined, in which case it will not appear in +the statistics output. + +=head2 Amanda::Find::find_result_t objects These objects contain information about dumps, as read from logfiles. Instance variables are: +To rename the current logfile to a datestamped logfile, call C +where C<$ts> is the write timestamp for this dump. The +C function will calculate this timestamp, +returning C on error. + =over -=item C<$timestamp> +=item C + +=item C -=item C<$hostname> +=item C -=item C<$diskname> +=item C -=item C<$level> +=item C