diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm
index 700d3be6..61893ea9 100644
--- a/Anvil/Tools/Database.pm
+++ b/Anvil/Tools/Database.pm
@@ -153,7 +153,8 @@ sub archive_database
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { host_type => $host_type }});
if ($host_type ne "dashboard")
{
- # ...
+ # Not a dashboard, don't archive
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0452"});
return(1);
}
@@ -161,7 +162,7 @@ sub archive_database
# it, if needed).
if (ref($tables) ne "ARRAY")
{
- $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0432"});
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0432"});
return(1);
}
@@ -205,7 +206,10 @@ sub archive_database
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { failed => $failed }});
if ($failed)
{
- # ...
+ # No directory to archive into...
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, priority => "err", key => "error_0098", variables => {
+ directory => $anvil->data->{sys}{database}{archive}{directory},
+ }});
return("!!error!!");
}
}
@@ -7314,6 +7318,7 @@ sub resync_databases
}
# Archive old data before resync'ing
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0451"});
$anvil->Database->archive_database({debug => $debug});
die;
@@ -8021,7 +8026,7 @@ sub _archive_table
next;
}
- # If there are more than
+ # Do some math...
my $to_remove = $count - $drop_to;
my $loops = (int($to_remove / $division) + 1);
my $records_per_loop = $anvil->Convert->round({number => ($to_remove / $loops)});
@@ -8030,6 +8035,12 @@ sub _archive_table
"s2:loops" => $loops,
"s3:records_per_loop" => $records_per_loop,
}});
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0453", variables => {
+ records => $anvil->Convert->add_commas({number => $to_remove }),
+ loops => $anvil->Convert->add_commas({number => $loops }),
+ table => $table,
+ host => $anvil->Database->get_host_from_uuid({short => 1, host_uuid => $uuid}),
+ }});
# There is enough data to trigger an archive, so lets get started with a list of columns in
# this table.
@@ -8110,6 +8121,10 @@ sub _archive_table
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { archive_file => $archive_file }});
# It may not be secure, but we play it safe.
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, key => "log_0454", variables => {
+ records => $anvil->Convert->add_commas({number => $count}),
+ file => $archive_file,
+ }});
my ($failed) = $anvil->Storage->write_file({
debug => $debug,
body => $sql_file,
@@ -8122,14 +8137,22 @@ sub _archive_table
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { failed => $failed }});
if ($failed)
{
- # ???
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 0, priority => "err", key => "error_0099", variables => {
+ file => $archive_file,
+ table => $table,
+ }});
last;
}
else
{
+ $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, key => "log_0283"});
$vacuum = 1;
$query = "DELETE FROM history.".$table." WHERE modified_date >= '".$modified_date."';";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { query => $query }});
+ if ($compress)
+ {
+
+ }
}
$offset -= $records_per_loop;
@@ -8413,6 +8436,7 @@ sub _mark_database_as_behind
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Database->_mark_database_as_behind()" }});
+
my $uuid = $parameter->{uuid} ? $parameter->{uuid} : "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { uuid => $uuid }});
diff --git a/share/words.xml b/share/words.xml
index fe4a35ff..c3196cf9 100644
--- a/share/words.xml
+++ b/share/words.xml
@@ -782,6 +782,10 @@ Failed to promote the DRBD resource: [#!variable!resource!#] primary. Expected a
Ready to parse: [#!variable!file!#].
Parsed: [#!variable!records!#], adding/updating them to the database now.
Skipping the network scan. The next scheduled scan will be done in: [#!variable!next_scan!#]. Override with '--force'.
+ Checking to see if any data needs to be archived before starting the resync.
+ Skipping archiving, not a Striker dashboard.
+ Archiving: [#!variable!records!#] over: [#!variable!loops!#] segments from the table: [#!variable!table!#] from the database on: [#!variable!host!#].
+ Writing: [#!variable!records!#] to the file: [#!variable!file!#].
Test
@@ -1037,7 +1041,7 @@ Failure! The return code: [#!variable!return_code!#] was received ('0' was expec
Removing conflicting packages.
Will now install: [#!variable!package!#].
Verifying installation.
- [ Failed ] - There may be more information in #!data!path::log::file!#.
+ [ Failed ] - There may be more information in #!data!path::log::main!#.
Success!
Adding our database connection information to the target's anvil.conf file.
Finished! The target should be ready for initial configuration shortly. If it isn't, please check that the 'anvil-daemon' daemon is running.
@@ -1063,7 +1067,7 @@ Failure! The return code: [#!variable!return_code!#] was received ('0' was expec
This job does a simple ping scan of the networks connected to this host. Any detected hosts have their MAC / IP addresses recorded. This is designed to help determine IP addresses assigned to servers hosted on the Anvil! system.
Adding the database connection information for the dashboard: [#!variable!host_name!#] to the target's anvil.conf file.
Unable to find a matching network, skipping this database.
- Something went wrong adding this database. Please see: [#!data!path::log::file!#] for details.
+ Something went wrong adding this database. Please see: [#!data!path::log::main!#] for details.
The IP address will change. You will need to reconnect after applying these changes.
@@ -1108,9 +1112,9 @@ Failure! The return code: [#!variable!return_code!#] was received ('0' was expec
read_details: [#!variable!uuid!#] is not a valid UUID.]]>
read_details: [#!variable!uuid!#] was not found in the database.]]>
Login failed, please try again.
- #!data!path::log::file!#] for details.]]>
+ #!data!path::log::main!#] for details.]]>
#!variable!template!#] in the template file: [#!variable!file!#].]]>
- #!variable!template!#] in the template file: [#!variable!file!#]. Details of the problem should be in: [#!data!path::log::file!#].]]>
+ #!variable!template!#] in the template file: [#!variable!file!#]. Details of the problem should be in: [#!data!path::log::main!#].]]>
The 'host-uuid': [#!variable!host_uuid!#] is not valid.
The '#!variable!switch!#' switch is missing.
The job UUID was passed via '--job-uuid' but the passed in value: [#!variable!uuid!#] is not a valid UUID.
@@ -1193,6 +1197,8 @@ Failed to generate an RSA public key for the user: [#!variable!user!#]. The outp
There was a problem downloading: [#!variable!url!#] to: [#!variable!file!#]. Aborting parsing of the OUI data.
The 'oui_mac_prefix': [#!variable!oui_mac_prefix!#] string doesn't appear to be a valid 6-byte hex string.
/' (subnet can be dotted-decimal or CIDR notation) or be 'bcn', 'sn', 'ifn' or a specific variant like 'bcn1', 'sn2', or 'ifn2'. Alternatively, so not use '--network X' at all and all networks with host is connected to will be scanned.]]>
+ Failed to create the archive directory: [#!variable!directory!#]. Skipping the archive process.
+ There was a problem writing out the records to file: [#!variable!file!#]. There may be more information in #!data!path::log::main!#. Skipping further attempts to archive: [#!variable!table!#].
Yes