org
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -38,15 +38,20 @@ import org.sleuthkit.autopsy.events.AutopsyEvent;
/**
* Monitors disk space and memory and cancels ingest if disk space runs low.
*
- * Note: This should be a singleton and currently is used as such, with the
- * only instance residing in the IngestManager class.
+ * Note: This should be a singleton and currently is used as such, with the only
+ * instance residing in the IngestManager class.
*/
public final class IngestMonitor {
public static final int DISK_FREE_SPACE_UNKNOWN = -1;
private static final int INITIAL_INTERVAL_MS = 60000; //1 min.
private static final int MAX_LOG_FILES = 3;
- private static final java.util.logging.Logger MONITOR_LOGGER = java.util.logging.Logger.getLogger("monitor"); //NON-NLS
+
+ /*
+ * The monitorLogger used the standard Java Logger type for compact logs
+ * without the stack trace.
+ */
+ private static final java.util.logging.Logger monitorLogger = java.util.logging.Logger.getLogger("monitor"); //NON-NLS
private final Logger logger = Logger.getLogger(IngestMonitor.class.getName());
private Timer timer;
private MonitorTimerAction timerAction;
@@ -63,8 +68,8 @@ public final class IngestMonitor {
FileHandler monitorLogHandler = new FileHandler(PlatformUtil.getUserDirectory().getAbsolutePath() + "/var/log/monitor.log", 0, MAX_LOG_FILES); //NON-NLS
monitorLogHandler.setFormatter(new SimpleFormatter());
monitorLogHandler.setEncoding(PlatformUtil.getLogFileEncoding());
- MONITOR_LOGGER.setUseParentHandlers(false);
- MONITOR_LOGGER.addHandler(monitorLogHandler);
+ monitorLogger.setUseParentHandlers(false);
+ monitorLogger.addHandler(monitorLogHandler);
} catch (IOException | SecurityException ex) {
logger.log(Level.SEVERE, "Failed to create memory usage logger", ex); //NON-NLS
}
@@ -202,7 +207,7 @@ public final class IngestMonitor {
IngestServices.getInstance().postMessage(IngestMessage.createManagerErrorMessage(
NbBundle.getMessage(this.getClass(), "IngestMonitor.mgrErrMsg.lowDiskSpace.title", diskPath),
NbBundle.getMessage(this.getClass(), "IngestMonitor.mgrErrMsg.lowDiskSpace.msg", diskPath)));
- MONITOR_LOGGER.log(Level.SEVERE, "Stopping ingest due to low disk space on {0}", diskPath); //NON-NLS
+ monitorLogger.log(Level.SEVERE, "Stopping ingest due to low disk space on {0}", diskPath); //NON-NLS
logger.log(Level.SEVERE, "Stopping ingest due to low disk space on {0}", diskPath); //NON-NLS
}
}
@@ -211,12 +216,13 @@ public final class IngestMonitor {
* Writes current message usage to the memory usage log.
*/
private void logMemoryUsage() {
- MONITOR_LOGGER.log(Level.INFO, PlatformUtil.getAllMemUsageInfo());
+ monitorLogger.log(Level.INFO, PlatformUtil.getAllMemUsageInfo());
}
-
+
/**
- * Writes current disk space usage of the drive where case dir resides to log.
- */
+ * Writes current disk space usage of the drive where case dir resides
+ * to log.
+ */
private void logDiskSpaceUsage() {
final long freeSpace = root.getFreeSpace();
logger.log(Level.INFO, "Available disk space on drive where case dir resides is {0} (bytes)", freeSpace); //NON-NLS
@@ -253,18 +259,17 @@ public final class IngestMonitor {
private long getFreeSpace() throws SecurityException {
// always return "UNKNOWN", see note below
return DISK_FREE_SPACE_UNKNOWN;
-
- /* NOTE: use and accuracy of this code for network drives needs to be investigated and validated
- final long freeSpace = root.getFreeSpace();
- if (0 == freeSpace) {
- // Check for a network drive, some network filesystems always
- // return zero.
- final String monitoredPath = root.getAbsolutePath();
- if (monitoredPath.startsWith("\\\\") || monitoredPath.startsWith("//")) {
- return DISK_FREE_SPACE_UNKNOWN;
- }
- }
- return freeSpace;*/
+
+ /*
+ * NOTE: use and accuracy of this code for network drives needs to
+ * be investigated and validated final long freeSpace =
+ * root.getFreeSpace(); if (0 == freeSpace) { // Check for a network
+ * drive, some network filesystems always // return zero. final
+ * String monitoredPath = root.getAbsolutePath(); if
+ * (monitoredPath.startsWith("\\\\") ||
+ * monitoredPath.startsWith("//")) { return DISK_FREE_SPACE_UNKNOWN;
+ * } } return freeSpace;
+ */
}
}
diff --git a/Core/test/qa-functional/src/org/sleuthkit/autopsy/ingest/IngestFileFiltersTest.java b/Core/test/qa-functional/src/org/sleuthkit/autopsy/ingest/IngestFileFiltersTest.java
index 972c3488e8..554d83a9d2 100644
--- a/Core/test/qa-functional/src/org/sleuthkit/autopsy/ingest/IngestFileFiltersTest.java
+++ b/Core/test/qa-functional/src/org/sleuthkit/autopsy/ingest/IngestFileFiltersTest.java
@@ -26,7 +26,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import static junit.framework.Assert.assertFalse;
-import junit.framework.TestCase;
import org.netbeans.junit.NbModuleSuite;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.CaseActionException;
@@ -48,6 +47,7 @@ import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.ExtensionCon
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.FullNameCondition;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.ParentPathCondition;
+import org.sleuthkit.autopsy.modules.photoreccarver.PhotoRecCarverIngestModuleFactory;
import org.sleuthkit.autopsy.testutils.DataSourceProcessorRunner;
import org.sleuthkit.autopsy.testutils.DataSourceProcessorRunner.ProcessorCallback;
import org.sleuthkit.autopsy.testutils.IngestJobRunner;
@@ -84,7 +84,7 @@ public class IngestFileFiltersTest extends NbTestCase {
Assert.fail(ex);
}
}
- assertFalse("Unable to delete existing test directory", CASE_DIRECTORY_PATH.toFile().exists());
+ assertFalse("Unable to delete existing test directory",CASE_DIRECTORY_PATH.toFile().exists());
// Create the test directory
CASE_DIRECTORY_PATH.toFile().mkdirs();
@@ -133,11 +133,13 @@ public class IngestFileFiltersTest extends NbTestCase {
HashMap rule = new HashMap<>();
rule.put("Rule", new Rule("testFileType", null, new MetaTypeCondition(MetaTypeCondition.Type.FILES), new ParentPathCondition("dir1"), null, null, null));
//Filter for dir1 and no unallocated space
- FilesSet Files_Dirs_Unalloc_Ingest_Filter = new FilesSet("Filter", "Filter to find all files in dir1.", false, true, rule);
+ FilesSet dirFilter = new FilesSet("Filter", "Filter to find all files in dir1.", false, true, rule);
try {
Case openCase = Case.getOpenCase();
- runIngestJob(openCase.getDataSources(), Files_Dirs_Unalloc_Ingest_Filter);
+ ArrayList templates = new ArrayList<>();
+ templates.add(getIngestModuleTemplate(new FileTypeIdModuleFactory()));
+ runIngestJob(openCase.getDataSources(), templates, dirFilter);
FileManager fileManager = openCase.getServices().getFileManager();
List results = fileManager.findFiles("file.jpg", "dir1");
String mimeType = results.get(0).getMIMEType();
@@ -171,7 +173,9 @@ public class IngestFileFiltersTest extends NbTestCase {
try {
Case openCase = Case.getOpenCase();
- runIngestJob(openCase.getDataSources(), filesExtDirsFilter);
+ ArrayList templates = new ArrayList<>();
+ templates.add(getIngestModuleTemplate(new FileTypeIdModuleFactory()));
+ runIngestJob(openCase.getDataSources(), templates, filesExtDirsFilter);
FileManager fileManager = Case.getOpenCase().getServices().getFileManager();
List results = fileManager.findFiles("%%");
assertEquals(62, results.size());
@@ -200,7 +204,9 @@ public class IngestFileFiltersTest extends NbTestCase {
try {
Case openCase = Case.getOpenCase();
- runIngestJob(openCase.getDataSources(), filesExtDirsFilter);
+ ArrayList templates = new ArrayList<>();
+ templates.add(getIngestModuleTemplate(new FileTypeIdModuleFactory()));
+ runIngestJob(openCase.getDataSources(), templates, filesExtDirsFilter);
FileManager fileManager = Case.getOpenCase().getServices().getFileManager();
List results = fileManager.findFiles("%%");
assertEquals(62, results.size());
@@ -236,7 +242,10 @@ public class IngestFileFiltersTest extends NbTestCase {
try {
Case openCase = Case.getOpenCase();
- runIngestJob(openCase.getDataSources(), fullNameFilter);
+ ArrayList templates = new ArrayList<>();
+ templates.add(getIngestModuleTemplate(new FileTypeIdModuleFactory()));
+
+ runIngestJob(openCase.getDataSources(), templates, fullNameFilter);
FileManager fileManager = Case.getOpenCase().getServices().getFileManager();
List results = fileManager.findFiles("%%");
assertEquals(62, results.size());
@@ -255,13 +264,80 @@ public class IngestFileFiltersTest extends NbTestCase {
Assert.fail(ex);
}
}
- private void runIngestJob(List datasources, FilesSet filter) {
- FileTypeIdModuleFactory factory = new FileTypeIdModuleFactory();
- IngestModuleIngestJobSettings settings = factory.getDefaultIngestJobSettings();
- IngestModuleTemplate template = new IngestModuleTemplate(factory, settings);
- template.setEnabled(true);
- ArrayList templates = new ArrayList<>();
- templates.add(template);
+
+ public void testCarvingWithExtRuleAndUnallocSpace() {
+ HashMap rules = new HashMap<>();
+ rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
+ rules.put("rule2", new Rule("FindGifExtention", new ExtensionCondition("gif"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
+
+ //Build the filter to find files with .jpg and .gif extension and unallocated space
+ FilesSet extensionFilter = new FilesSet("Filter", "Filter to files with .jpg and .gif extension.", false, false, rules);
+
+ try {
+ Case openCase = Case.getOpenCase();
+ ArrayList templates = new ArrayList<>();
+ templates.add(getIngestModuleTemplate(new FileTypeIdModuleFactory()));
+ templates.add(getIngestModuleTemplate(new PhotoRecCarverIngestModuleFactory()));
+ runIngestJob(openCase.getDataSources(), templates, extensionFilter);
+ FileManager fileManager = Case.getOpenCase().getServices().getFileManager();
+ List results = fileManager.findFiles("%%");
+ assertEquals(70, results.size());
+ int carvedJpgGifFiles = 0;
+ for (AbstractFile file : results) {
+ if (file.getNameExtension().equalsIgnoreCase("jpg") || file.getNameExtension().equalsIgnoreCase("gif")) { //Unalloc file and .jpg files in dir1, dir2, $CarvedFiles, root directory should have MIME type
+ String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
+ assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
+
+ if (file.getParentPath().equalsIgnoreCase("/$CarvedFiles/")) {
+ carvedJpgGifFiles++;
+ }
+ } else if (file.getName().startsWith("Unalloc_")) {
+ String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
+ assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
+ } else { //All other files should not have MIME type.
+ String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
+ assertTrue(errMsg, file.getMIMEType() == null);
+ }
+ }
+ //Make sure we have carved jpg/gif files
+ assertEquals(2, carvedJpgGifFiles);
+
+ } catch (NoCurrentCaseException | TskCoreException ex) {
+ Exceptions.printStackTrace(ex);
+ Assert.fail(ex);
+ }
+ }
+
+ public void testCarvingNoUnallocatedSpace() {
+ HashMap rules = new HashMap<>();
+ rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
+ rules.put("rule2", new Rule("FindGifExtention", new ExtensionCondition("gif"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
+
+ //Build the filter to find files with .jpg and .gif extension
+ FilesSet extensionFilter = new FilesSet("Filter", "Filter to files with .jpg and .gif extension.", false, true, rules);
+
+ try {
+ Case openCase = Case.getOpenCase();
+ ArrayList templates = new ArrayList<>();
+ templates.add(getIngestModuleTemplate(new FileTypeIdModuleFactory()));
+ templates.add(getIngestModuleTemplate(new PhotoRecCarverIngestModuleFactory()));
+ IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates, extensionFilter);
+ try {
+ List errs = IngestJobRunner.runIngestJob(openCase.getDataSources(), ingestJobSettings);
+ //Ingest fails because Carving wants unallocated space
+ assertEquals(1, errs.size());
+ assertEquals("PhotoRec Carver", errs.get(0).getModuleDisplayName());
+ } catch (InterruptedException ex) {
+ Exceptions.printStackTrace(ex);
+ Assert.fail(ex);
+ }
+ } catch (NoCurrentCaseException | TskCoreException ex) {
+ Exceptions.printStackTrace(ex);
+ Assert.fail(ex);
+ }
+ }
+
+ private void runIngestJob(List datasources, ArrayList templates, FilesSet filter) {
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates, filter);
try {
List errs = IngestJobRunner.runIngestJob(datasources, ingestJobSettings);
@@ -275,4 +351,10 @@ public class IngestFileFiltersTest extends NbTestCase {
}
}
+ private IngestModuleTemplate getIngestModuleTemplate(IngestModuleFactoryAdapter factory) {
+ IngestModuleIngestJobSettings settings = factory.getDefaultIngestJobSettings();
+ IngestModuleTemplate template = new IngestModuleTemplate(factory, settings);
+ template.setEnabled(true);
+ return template;
+ }
}
diff --git a/CoreLibs/build.xml b/CoreLibs/build.xml
index 4084652c2c..f4c8cf0844 100644
--- a/CoreLibs/build.xml
+++ b/CoreLibs/build.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/Experimental/build.xml b/Experimental/build.xml
index b3923a5c30..3264616a39 100644
--- a/Experimental/build.xml
+++ b/Experimental/build.xml
@@ -13,7 +13,7 @@
-
+
diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestControlPanel.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestControlPanel.java
index d097882053..3b7d91331f 100644
--- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestControlPanel.java
+++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestControlPanel.java
@@ -43,7 +43,6 @@ import java.io.File;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTable;
@@ -60,6 +59,7 @@ import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.core.ServicesMonitor;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@@ -141,7 +141,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
private static final int COMPLETED_TIME_COL_PREFERRED_WIDTH = 280;
private static final String UPDATE_TASKS_THREAD_NAME = "AID-update-tasks-%d";
private static final String LOCAL_HOST_NAME = NetworkUtils.getLocalHostName();
- private static final Logger SYS_LOGGER = AutoIngestSystemLogger.getLogger();
+ private static final Logger sysLogger = AutoIngestSystemLogger.getLogger();
private static AutoIngestControlPanel instance;
private final DefaultTableModel pendingTableModel;
private final DefaultTableModel runningTableModel;
@@ -333,7 +333,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
serviceStatus = NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.tbServicesStatusMessage.Message.Down");
}
} catch (ServicesMonitor.ServicesMonitorException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Dashboard error getting service status for %s", service), ex);
+ sysLogger.log(Level.SEVERE, String.format("Dashboard error getting service status for %s", service), ex);
}
return serviceStatus;
}
@@ -687,7 +687,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
manager.startUp();
autoIngestStarted = true;
} catch (AutoIngestManager.AutoIngestManagerException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Dashboard error starting up auto ingest", ex);
+ sysLogger.log(Level.SEVERE, "Dashboard error starting up auto ingest", ex);
tbStatusMessage.setText(NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.AutoIngestStartupError"));
manager = null;
@@ -712,7 +712,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
status = NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.tbServicesStatusMessage.Message.Up");
} else if (status.equals(ServicesMonitor.ServiceStatus.DOWN.toString())) {
status = NbBundle.getMessage(AutoIngestControlPanel.class, "AutoIngestControlPanel.tbServicesStatusMessage.Message.Down");
- SYS_LOGGER.log(Level.SEVERE, "Connection to {0} is down", serviceDisplayName); //NON-NLS
+ sysLogger.log(Level.SEVERE, "Connection to {0} is down", serviceDisplayName); //NON-NLS
}
// if the status update is for an existing service who's status hasn't changed - do nothing.
@@ -1187,7 +1187,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
job.getPriority()}); // PRIORITY
}
} catch (Exception ex) {
- SYS_LOGGER.log(Level.SEVERE, "Dashboard error refreshing table", ex);
+ sysLogger.log(Level.SEVERE, "Dashboard error refreshing table", ex);
}
}
@@ -1823,7 +1823,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
try {
manager.prioritizeCase(caseName);
} catch (AutoIngestManager.AutoIngestManagerException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Error prioritizing a case", ex);
+ sysLogger.log(Level.SEVERE, "Error prioritizing a case", ex);
MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_casePrioritization());
}
refreshTables();
@@ -1862,7 +1862,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
}
}
} catch (IOException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Dashboard error attempting to display case auto ingest log", ex);
+ sysLogger.log(Level.SEVERE, "Dashboard error attempting to display case auto ingest log", ex);
Object[] options = {org.openide.util.NbBundle.getMessage(AutoIngestControlPanel.class, "DisplayLogDialog.okay")};
JOptionPane.showOptionDialog(this,
org.openide.util.NbBundle.getMessage(AutoIngestControlPanel.class, "DisplayLogDialog.cannotFindLog"),
@@ -1883,7 +1883,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
try {
manager.prioritizeJob(manifestFilePath);
} catch (AutoIngestManager.AutoIngestManagerException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Error prioritizing a job", ex);
+ sysLogger.log(Level.SEVERE, "Error prioritizing a job", ex);
MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_jobPrioritization());
}
refreshTables();
@@ -1930,7 +1930,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
try {
manager.deprioritizeCase(caseName);
} catch (AutoIngestManager.AutoIngestManagerException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Error deprioritizing a case", ex);
+ sysLogger.log(Level.SEVERE, "Error deprioritizing a case", ex);
MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_caseDeprioritization());
}
refreshTables();
@@ -1949,7 +1949,7 @@ public final class AutoIngestControlPanel extends JPanel implements Observer {
try {
manager.deprioritizeJob(manifestFilePath);
} catch (AutoIngestManager.AutoIngestManagerException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Error deprioritizing a job", ex);
+ sysLogger.log(Level.SEVERE, "Error deprioritizing a job", ex);
MessageNotifyUtil.Message.error(Bundle.AutoIngestControlPanel_errorMessage_jobDeprioritization());
}
refreshTables();
diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java
index cc162494ae..8a1228cde4 100644
--- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java
+++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java
@@ -76,6 +76,7 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback.DataSourceProcessorResult;
import static org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorProgressMonitor;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
import org.sleuthkit.autopsy.events.AutopsyEvent;
import org.sleuthkit.autopsy.events.AutopsyEventException;
@@ -137,7 +138,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private static final String JOB_STATUS_PUBLISHING_THREAD_NAME = "AIM-job-status-event-publisher-%d";
private static final long MAX_MISSED_JOB_STATUS_UPDATES = 10;
private static final int DEFAULT_PRIORITY = 0;
- private static final java.util.logging.Logger SYS_LOGGER = AutoIngestSystemLogger.getLogger();
+ private static final Logger sysLogger = AutoIngestSystemLogger.getLogger();
private static AutoIngestManager instance;
private final AutopsyEventPublisher eventPublisher;
private final Object scanMonitor;
@@ -184,7 +185,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* designated input directory tree.
*/
private AutoIngestManager() {
- SYS_LOGGER.log(Level.INFO, "Initializing auto ingest");
+ sysLogger.log(Level.INFO, "Initializing auto ingest");
state = State.IDLE;
eventPublisher = new AutopsyEventPublisher();
scanMonitor = new Object();
@@ -200,9 +201,9 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
completedJobs = new ArrayList<>();
try {
RuntimeProperties.setRunningWithGUI(false);
- SYS_LOGGER.log(Level.INFO, "Set running with desktop GUI runtime property to false");
+ sysLogger.log(Level.INFO, "Set running with desktop GUI runtime property to false");
} catch (RuntimeProperties.RuntimePropertiesException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Failed to set running with desktop GUI runtime property to false", ex);
+ sysLogger.log(Level.SEVERE, "Failed to set running with desktop GUI runtime property to false", ex);
}
}
@@ -213,7 +214,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* ingest.
*/
void startUp() throws AutoIngestManagerException {
- SYS_LOGGER.log(Level.INFO, "Auto ingest starting");
+ sysLogger.log(Level.INFO, "Auto ingest starting");
try {
coordinationService = CoordinationService.getInstance();
} catch (CoordinationServiceException ex) {
@@ -221,9 +222,9 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
}
try {
eventPublisher.openRemoteEventChannel(EVENT_CHANNEL_NAME);
- SYS_LOGGER.log(Level.INFO, "Opened auto ingest event channel");
+ sysLogger.log(Level.INFO, "Opened auto ingest event channel");
} catch (AutopsyEventException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Failed to open auto ingest event channel", ex);
+ sysLogger.log(Level.SEVERE, "Failed to open auto ingest event channel", ex);
throw new AutoIngestManagerException("Failed to open auto ingest event channel", ex);
}
rootInputDirectory = Paths.get(AutoIngestUserPreferences.getAutoModeImageFolder());
@@ -396,7 +397,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
if (State.RUNNING != state) {
return;
}
- SYS_LOGGER.log(Level.INFO, "Auto ingest shutting down");
+ sysLogger.log(Level.INFO, "Auto ingest shutting down");
state = State.SHUTTING_DOWN;
try {
eventPublisher.removeSubscriber(EVENT_LIST, instance);
@@ -406,9 +407,9 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
cleanupJobs();
} catch (InterruptedException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Auto ingest interrupted during shut down", ex);
+ sysLogger.log(Level.SEVERE, "Auto ingest interrupted during shut down", ex);
}
- SYS_LOGGER.log(Level.INFO, "Auto ingest shut down");
+ sysLogger.log(Level.INFO, "Auto ingest shut down");
state = State.IDLE;
}
@@ -420,10 +421,10 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
inputScanSchedulingExecutor.shutdownNow();
inputScanExecutor.shutdownNow();
while (!inputScanSchedulingExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
- SYS_LOGGER.log(Level.WARNING, "Auto ingest waited at least thirty seconds for input scan scheduling executor to shut down, continuing to wait"); //NON-NLS
+ sysLogger.log(Level.WARNING, "Auto ingest waited at least thirty seconds for input scan scheduling executor to shut down, continuing to wait"); //NON-NLS
}
while (!inputScanExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
- SYS_LOGGER.log(Level.WARNING, "Auto ingest waited at least thirty seconds for input scan executor to shut down, continuing to wait"); //NON-NLS
+ sysLogger.log(Level.WARNING, "Auto ingest waited at least thirty seconds for input scan executor to shut down, continuing to wait"); //NON-NLS
}
}
@@ -439,7 +440,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
jobProcessingExecutor.shutdown();
}
while (!jobProcessingExecutor.awaitTermination(30, TimeUnit.SECONDS)) {
- SYS_LOGGER.log(Level.WARNING, "Auto ingest waited at least thirty seconds for job processing executor to shut down, continuing to wait"); //NON-NLS
+ sysLogger.log(Level.WARNING, "Auto ingest waited at least thirty seconds for job processing executor to shut down, continuing to wait"); //NON-NLS
}
}
@@ -506,11 +507,11 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
if (State.RUNNING != state) {
return;
}
- SYS_LOGGER.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory);
+ sysLogger.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory);
InputDirScanner scanner = new InputDirScanner();
scanner.scan();
- SYS_LOGGER.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory);
+ sysLogger.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory);
}
/**
@@ -772,10 +773,10 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
updateCoordinationServiceManifestNode(completedJob);
pendingJobs.add(completedJob);
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Coordination service error while reprocessing %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Coordination service error while reprocessing %s", manifestPath), ex);
completedJobs.add(completedJob);
} catch (InterruptedException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Unexpected interrupt while updating coordination service node data for {0}", manifestPath);
+ sysLogger.log(Level.SEVERE, "Unexpected interrupt while updating coordination service node data for {0}", manifestPath);
completedJobs.add(completedJob);
}
}
@@ -811,7 +812,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try {
metaData = new CaseMetadata(caseMetaDataFilePath);
} catch (CaseMetadata.CaseMetadataException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Failed to get case metadata file %s for case %s at %s", caseMetaDataFilePath, caseName, caseDirectoryPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Failed to get case metadata file %s for case %s at %s", caseMetaDataFilePath, caseName, caseDirectoryPath), ex);
return CaseDeletionResult.FAILED;
}
@@ -822,7 +823,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
scanner.scan();
Set manifestPaths = casesToManifests.get(caseName);
if (null == manifestPaths) {
- SYS_LOGGER.log(Level.SEVERE, String.format("No manifest paths found for case %s at %s", caseName, caseDirectoryPath));
+ sysLogger.log(Level.SEVERE, String.format("No manifest paths found for case %s at %s", caseName, caseDirectoryPath));
return CaseDeletionResult.FAILED;
}
@@ -840,7 +841,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
return CaseDeletionResult.FAILED;
}
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to acquire manifest lock for %s for case %s at %s", manifestPath, caseName, caseDirectoryPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to acquire manifest lock for %s for case %s at %s", manifestPath, caseName, caseDirectoryPath), ex);
return CaseDeletionResult.FAILED;
}
}
@@ -851,7 +852,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
Case.deleteCase(metaData);
} catch (CaseActionException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Failed to physically delete case %s at %s", caseName, caseDirectoryPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Failed to physically delete case %s at %s", caseName, caseDirectoryPath), ex);
return CaseDeletionResult.FAILED;
}
@@ -865,10 +866,10 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
deletedJob.setProcessingStatus(AutoIngestJob.ProcessingStatus.DELETED);
this.updateCoordinationServiceManifestNode(deletedJob);
} catch (AutoIngestJobNodeData.InvalidDataException | AutoIngestJobException ex) {
- SYS_LOGGER.log(Level.WARNING, String.format("Invalid auto ingest job node data for %s", manifestPath), ex);
+ sysLogger.log(Level.WARNING, String.format("Invalid auto ingest job node data for %s", manifestPath), ex);
return CaseDeletionResult.PARTIALLY_DELETED;
} catch (InterruptedException | CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set delete flag on manifest data for %s for case %s at %s", manifestPath, caseName, caseDirectoryPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to set delete flag on manifest data for %s for case %s at %s", manifestPath, caseName, caseDirectoryPath), ex);
return CaseDeletionResult.PARTIALLY_DELETED;
}
}
@@ -895,7 +896,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try {
lock.release();
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Failed to release manifest file lock when deleting case %s at %s", caseName, caseDirectoryPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Failed to release manifest file lock when deleting case %s at %s", caseName, caseDirectoryPath), ex);
}
}
}
@@ -944,7 +945,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
synchronized (jobsLock) {
if (null != currentJob) {
currentJob.cancel();
- SYS_LOGGER.log(Level.INFO, "Cancelling automated ingest for manifest {0}", currentJob.getManifest().getFilePath());
+ sysLogger.log(Level.INFO, "Cancelling automated ingest for manifest {0}", currentJob.getManifest().getFilePath());
}
}
}
@@ -965,7 +966,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
if (null != moduleHandle) {
currentJob.setProcessingStage(AutoIngestJob.Stage.CANCELLING_MODULE, Date.from(Instant.now()));
moduleHandle.cancel();
- SYS_LOGGER.log(Level.INFO, "Cancelling {0} module for manifest {1}", new Object[]{moduleHandle.displayName(), currentJob.getManifest().getFilePath()});
+ sysLogger.log(Level.INFO, "Cancelling {0} module for manifest {1}", new Object[]{moduleHandle.displayName(), currentJob.getManifest().getFilePath()});
}
}
}
@@ -1015,7 +1016,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* input directory scan task executor.
*/
private InputDirScanSchedulingTask() {
- SYS_LOGGER.log(Level.INFO, "Periodic input scan scheduling task started");
+ sysLogger.log(Level.INFO, "Periodic input scan scheduling task started");
}
/**
@@ -1045,10 +1046,10 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
if (Thread.currentThread().isInterrupted()) {
return null;
}
- SYS_LOGGER.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory);
+ sysLogger.log(Level.INFO, "Starting input scan of {0}", rootInputDirectory);
InputDirScanner scanner = new InputDirScanner();
scanner.scan();
- SYS_LOGGER.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory);
+ sysLogger.log(Level.INFO, "Completed input scan of {0}", rootInputDirectory);
setChanged();
notifyObservers(Event.INPUT_SCAN_COMPLETED);
return null;
@@ -1090,7 +1091,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* uncaught exceptions will propagate up to the calling
* thread and may stop it from running.
*/
- SYS_LOGGER.log(Level.SEVERE, String.format("Error scanning the input directory %s", rootInputDirectory), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error scanning the input directory %s", rootInputDirectory), ex);
}
}
synchronized (scanMonitor) {
@@ -1151,7 +1152,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
manifest = parser.parse(filePath);
break;
} catch (ManifestFileParserException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to parse %s with parser %s", filePath, parser.getClass().getCanonicalName()), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to parse %s with parser %s", filePath, parser.getClass().getCanonicalName()), ex);
}
}
if (Thread.currentThread().isInterrupted()) {
@@ -1205,21 +1206,21 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
break;
default:
- SYS_LOGGER.log(Level.SEVERE, "Unknown ManifestNodeData.ProcessingStatus");
+ sysLogger.log(Level.SEVERE, "Unknown ManifestNodeData.ProcessingStatus");
break;
}
} catch (AutoIngestJobNodeData.InvalidDataException | AutoIngestJobException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Invalid auto ingest job node data for %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Invalid auto ingest job node data for %s", manifestPath), ex);
}
} else {
try {
addNewPendingJob(manifest);
} catch (AutoIngestJobException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Invalid manifest data for %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Invalid manifest data for %s", manifestPath), ex);
}
}
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error transmitting node data for %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error transmitting node data for %s", manifestPath), ex);
return CONTINUE;
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
@@ -1231,7 +1232,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
// Catch all unhandled and unexpected exceptions. Otherwise one bad file
// can stop the entire input folder scanning. Given that the exception is unexpected,
// I'm hesitant to add logging which requires accessing or de-referencing data.
- SYS_LOGGER.log(Level.SEVERE, "Unexpected exception in file visitor", ex);
+ sysLogger.log(Level.SEVERE, "Unexpected exception in file visitor", ex);
return CONTINUE;
}
@@ -1288,7 +1289,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
updateCoordinationServiceManifestNode(job);
}
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
}
}
Path caseDirectory = PathUtils.findCaseDirectory(rootOutputDirectory, manifest.getCaseName());
@@ -1330,7 +1331,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
newPendingJobsList.add(job);
}
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
}
}
@@ -1361,7 +1362,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
String manifestPath = manifest.getFilePath().toString();
try (Lock manifestLock = coordinationService.tryGetExclusiveLock(CoordinationService.CategoryNode.MANIFESTS, manifestPath)) {
if (null != manifestLock) {
- SYS_LOGGER.log(Level.SEVERE, "Attempting crash recovery for {0}", manifestPath);
+ sysLogger.log(Level.SEVERE, "Attempting crash recovery for {0}", manifestPath);
try {
Path caseDirectoryPath = PathUtils.findCaseDirectory(rootOutputDirectory, manifest.getCaseName());
@@ -1386,7 +1387,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try {
setCaseNodeDataErrorsOccurred(caseDirectoryPath);
} catch (CaseNodeData.InvalidDataException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to get case node data for %s", caseDirectoryPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to get case node data for %s", caseDirectoryPath), ex);
}
} else {
job.setErrorsOccurred(false);
@@ -1398,7 +1399,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try {
new AutoIngestJobLogger(manifest.getFilePath(), manifest.getDataSourceFileName(), caseDirectoryPath).logCrashRecoveryWithRetry();
} catch (AutoIngestJobLoggerException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error creating case auto ingest log entry for crashed job for %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error creating case auto ingest log entry for crashed job for %s", manifestPath), ex);
}
}
} else {
@@ -1407,7 +1408,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try {
new AutoIngestJobLogger(manifest.getFilePath(), manifest.getDataSourceFileName(), caseDirectoryPath).logCrashRecoveryNoRetry();
} catch (AutoIngestJobLoggerException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error creating case auto ingest log entry for crashed job for %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error creating case auto ingest log entry for crashed job for %s", manifestPath), ex);
}
}
}
@@ -1419,7 +1420,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try {
updateCoordinationServiceManifestNode(job);
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifestPath), ex);
return;
}
@@ -1435,12 +1436,12 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try {
manifestLock.release();
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to release exclusive lock for %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to release exclusive lock for %s", manifestPath), ex);
}
}
}
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to get exclusive lock for %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to get exclusive lock for %s", manifestPath), ex);
}
}
@@ -1495,13 +1496,13 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
updateCoordinationServiceManifestNode(job);
}
} catch (CoordinationServiceException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error attempting to set node data for %s", manifest.getFilePath()), ex);
}
}
newCompletedJobsList.add(job);
} else {
- SYS_LOGGER.log(Level.WARNING, String.format("Job completed for %s, but cannot find case directory, ignoring job", nodeData.getManifestFilePath()));
+ sysLogger.log(Level.WARNING, String.format("Job completed for %s, but cannot find case directory, ignoring job", nodeData.getManifestFilePath()));
}
}
@@ -1522,7 +1523,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
@Override
public FileVisitResult visitFileFailed(Path file, IOException ex) throws IOException {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error while visiting %s during input directories scan", file.toString()), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error while visiting %s during input directories scan", file.toString()), ex);
if (Thread.currentThread().isInterrupted()) {
return TERMINATE;
}
@@ -1607,7 +1608,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
@Override
public void run() {
- SYS_LOGGER.log(Level.INFO, "Job processing task started");
+ sysLogger.log(Level.INFO, "Job processing task started");
while (true) {
try {
if (jobProcessingTaskFuture.isCancelled()) {
@@ -1650,14 +1651,14 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
} else {
errorState = ErrorState.UNEXPECTED_EXCEPTION;
}
- SYS_LOGGER.log(Level.SEVERE, "Auto ingest system error", ex);
+ sysLogger.log(Level.SEVERE, "Auto ingest system error", ex);
pauseForSystemError();
}
} catch (InterruptedException ex) {
break;
}
}
- SYS_LOGGER.log(Level.INFO, "Job processing task stopped");
+ sysLogger.log(Level.INFO, "Job processing task stopped");
}
/**
@@ -1666,7 +1667,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
private void requestPause() {
synchronized (pauseLock) {
- SYS_LOGGER.log(Level.INFO, "Job processing pause requested");
+ sysLogger.log(Level.INFO, "Job processing pause requested");
pauseRequested = true;
if (waitingForInputScan) {
/*
@@ -1689,7 +1690,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
private void requestResume() {
synchronized (pauseLock) {
- SYS_LOGGER.log(Level.INFO, "Job processing resume requested");
+ sysLogger.log(Level.INFO, "Job processing resume requested");
pauseRequested = false;
if (waitingForInputScan) {
/*
@@ -1719,12 +1720,12 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void pauseIfRequested() throws InterruptedException {
synchronized (pauseLock) {
if (pauseRequested) {
- SYS_LOGGER.log(Level.INFO, "Job processing paused by request");
+ sysLogger.log(Level.INFO, "Job processing paused by request");
pauseRequested = false;
setChanged();
notifyObservers(Event.PAUSED_BY_REQUEST);
pauseLock.wait();
- SYS_LOGGER.log(Level.INFO, "Job processing resumed after pause request");
+ sysLogger.log(Level.INFO, "Job processing resumed after pause request");
setChanged();
notifyObservers(Event.RESUMED);
}
@@ -1740,12 +1741,12 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
private void pauseForSystemError() throws InterruptedException {
synchronized (pauseLock) {
- SYS_LOGGER.log(Level.SEVERE, "Job processing paused for system error");
+ sysLogger.log(Level.SEVERE, "Job processing paused for system error");
setChanged();
notifyObservers(Event.PAUSED_FOR_SYSTEM_ERROR);
pauseLock.wait();
errorState = ErrorState.NONE;
- SYS_LOGGER.log(Level.INFO, "Job processing resumed after system error");
+ sysLogger.log(Level.INFO, "Job processing resumed after system error");
setChanged();
notifyObservers(Event.RESUMED);
}
@@ -1775,11 +1776,11 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
waitingForInputScan = true;
}
- SYS_LOGGER.log(Level.INFO, "Job processing waiting for input scan completion");
+ sysLogger.log(Level.INFO, "Job processing waiting for input scan completion");
synchronized (scanMonitor) {
scanMonitor.wait();
}
- SYS_LOGGER.log(Level.INFO, "Job processing finished wait for input scan completion");
+ sysLogger.log(Level.INFO, "Job processing finished wait for input scan completion");
synchronized (pauseLock) {
waitingForInputScan = false;
pauseIfRequested();
@@ -1845,7 +1846,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* job.
*/
private void processJobs() throws CoordinationServiceException, SharedConfigurationException, ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException, CaseManagementException, AnalysisStartupException, FileExportException, AutoIngestJobLoggerException, InterruptedException, AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException, AutoIngestJobNodeData.InvalidDataException, CaseNodeData.InvalidDataException, JobMetricsCollectionException {
- SYS_LOGGER.log(Level.INFO, "Started processing pending jobs queue");
+ sysLogger.log(Level.INFO, "Started processing pending jobs queue");
Lock manifestLock = JobProcessingTask.this.dequeueAndLockNextJob();
while (null != manifestLock) {
try {
@@ -1895,20 +1896,20 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* while reading the lock data
*/
private Lock dequeueAndLockNextJob() throws CoordinationServiceException, InterruptedException {
- SYS_LOGGER.log(Level.INFO, "Checking pending jobs queue for ready job, enforcing max jobs per case");
+ sysLogger.log(Level.INFO, "Checking pending jobs queue for ready job, enforcing max jobs per case");
Lock manifestLock;
synchronized (jobsLock) {
manifestLock = dequeueAndLockNextJob(true);
if (null != manifestLock) {
- SYS_LOGGER.log(Level.INFO, "Dequeued job for {0}", currentJob.getManifest().getFilePath());
+ sysLogger.log(Level.INFO, "Dequeued job for {0}", currentJob.getManifest().getFilePath());
} else {
- SYS_LOGGER.log(Level.INFO, "No ready job");
- SYS_LOGGER.log(Level.INFO, "Checking pending jobs queue for ready job, not enforcing max jobs per case");
+ sysLogger.log(Level.INFO, "No ready job");
+ sysLogger.log(Level.INFO, "Checking pending jobs queue for ready job, not enforcing max jobs per case");
manifestLock = dequeueAndLockNextJob(false);
if (null != manifestLock) {
- SYS_LOGGER.log(Level.INFO, "Dequeued job for {0}", currentJob.getManifest().getFilePath());
+ sysLogger.log(Level.INFO, "Dequeued job for {0}", currentJob.getManifest().getFilePath());
} else {
- SYS_LOGGER.log(Level.INFO, "No ready job");
+ sysLogger.log(Level.INFO, "No ready job");
}
}
}
@@ -1980,7 +1981,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
currentJob = job;
break;
} catch (AutoIngestJobNodeData.InvalidDataException ex) {
- SYS_LOGGER.log(Level.WARNING, String.format("Unable to use node data for %s", manifestPath), ex); // JCTODO: Is this right?
+ sysLogger.log(Level.WARNING, String.format("Unable to use node data for %s", manifestPath), ex); // JCTODO: Is this right?
}
}
}
@@ -2047,7 +2048,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
private void processJob() throws CoordinationServiceException, SharedConfigurationException, ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException, CaseManagementException, AnalysisStartupException, FileExportException, AutoIngestJobLoggerException, InterruptedException, AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException, CaseNodeData.InvalidDataException, JobMetricsCollectionException {
Path manifestPath = currentJob.getManifest().getFilePath();
- SYS_LOGGER.log(Level.INFO, "Started processing of {0}", manifestPath);
+ sysLogger.log(Level.INFO, "Started processing of {0}", manifestPath);
currentJob.setProcessingStatus(AutoIngestJob.ProcessingStatus.PROCESSING);
currentJob.setProcessingStage(AutoIngestJob.Stage.STARTING, Date.from(Instant.now()));
currentJob.setProcessingHostName(AutoIngestManager.LOCAL_HOST_NAME);
@@ -2078,7 +2079,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
updateCoordinationServiceManifestNode(currentJob);
boolean retry = (!currentJob.isCanceled() && !currentJob.isCompleted());
- SYS_LOGGER.log(Level.INFO, "Completed processing of {0}, retry = {1}", new Object[]{manifestPath, retry});
+ sysLogger.log(Level.INFO, "Completed processing of {0}, retry = {1}", new Object[]{manifestPath, retry});
if (currentJob.isCanceled()) {
Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
if (null != caseDirectoryPath) {
@@ -2173,7 +2174,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void updateConfiguration() throws SharedConfigurationException, InterruptedException {
if (AutoIngestUserPreferences.getSharedConfigEnabled()) {
Path manifestPath = currentJob.getManifest().getFilePath();
- SYS_LOGGER.log(Level.INFO, "Downloading shared configuration for {0}", manifestPath);
+ sysLogger.log(Level.INFO, "Downloading shared configuration for {0}", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.UPDATING_SHARED_CONFIG, Date.from(Instant.now()));
new SharedConfiguration().downloadConfiguration();
}
@@ -2191,7 +2192,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
*/
private void verifyRequiredSevicesAreRunning() throws ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException {
Path manifestPath = currentJob.getManifest().getFilePath();
- SYS_LOGGER.log(Level.INFO, "Checking services availability for {0}", manifestPath);
+ sysLogger.log(Level.INFO, "Checking services availability for {0}", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.CHECKING_SERVICES, Date.from(Instant.now()));
if (!isServiceUp(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString())) {
throw new DatabaseServerDownException("Case database server is down");
@@ -2238,7 +2239,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private Case openCase() throws CoordinationServiceException, CaseManagementException, InterruptedException {
Manifest manifest = currentJob.getManifest();
String caseName = manifest.getCaseName();
- SYS_LOGGER.log(Level.INFO, "Opening case {0} for {1}", new Object[]{caseName, manifest.getFilePath()});
+ sysLogger.log(Level.INFO, "Opening case {0} for {1}", new Object[]{caseName, manifest.getFilePath()});
currentJob.setProcessingStage(AutoIngestJob.Stage.OPENING_CASE, Date.from(Instant.now()));
/*
* Acquire and hold a case name lock so that only one node at as
@@ -2272,7 +2273,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
}
currentJob.setCaseDirectoryPath(caseDirectoryPath);
Case caseForJob = Case.getOpenCase();
- SYS_LOGGER.log(Level.INFO, "Opened case {0} for {1}", new Object[]{caseForJob.getName(), manifest.getFilePath()});
+ sysLogger.log(Level.INFO, "Opened case {0} for {1}", new Object[]{caseForJob.getName(), manifest.getFilePath()});
return caseForJob;
} catch (KeywordSearchModuleException ex) {
@@ -2417,14 +2418,14 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private AutoIngestDataSource identifyDataSource() throws AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException {
Manifest manifest = currentJob.getManifest();
Path manifestPath = manifest.getFilePath();
- SYS_LOGGER.log(Level.INFO, "Identifying data source for {0} ", manifestPath);
+ sysLogger.log(Level.INFO, "Identifying data source for {0} ", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.IDENTIFYING_DATA_SOURCE, Date.from(Instant.now()));
Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath);
Path dataSourcePath = manifest.getDataSourcePath();
File dataSource = dataSourcePath.toFile();
if (!dataSource.exists()) {
- SYS_LOGGER.log(Level.SEVERE, "Missing data source for {0}", manifestPath);
+ sysLogger.log(Level.SEVERE, "Missing data source for {0}", manifestPath);
currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath);
jobLogger.logMissingDataSource();
@@ -2451,7 +2452,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void runDataSourceProcessor(Case caseForJob, AutoIngestDataSource dataSource) throws InterruptedException, AutoIngestJobLoggerException, AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException, CaseNodeData.InvalidDataException, CoordinationServiceException {
Manifest manifest = currentJob.getManifest();
Path manifestPath = manifest.getFilePath();
- SYS_LOGGER.log(Level.INFO, "Adding data source for {0} ", manifestPath);
+ sysLogger.log(Level.INFO, "Adding data source for {0} ", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.ADDING_DATA_SOURCE, Date.from(Instant.now()));
DataSourceProcessorProgressMonitor progressMonitor = new DoNothingDSPProgressMonitor();
Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
@@ -2463,7 +2464,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try {
validDataSourceProcessors = DataSourceProcessorUtility.getOrderedListOfDataSourceProcessors(dataSource.getPath());
} catch (AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException ex) {
- SYS_LOGGER.log(Level.SEVERE, "Exception while determining best data source processor for {0}", dataSource.getPath());
+ sysLogger.log(Level.SEVERE, "Exception while determining best data source processor for {0}", dataSource.getPath());
// rethrow the exception. It will get caught & handled upstream and will result in AIM auto-pause.
throw ex;
}
@@ -2474,7 +2475,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
setCaseNodeDataErrorsOccurred(caseDirectoryPath);
currentJob.setErrorsOccurred(true);
jobLogger.logFailedToIdentifyDataSource();
- SYS_LOGGER.log(Level.WARNING, "Unsupported data source {0} for {1}", new Object[]{dataSource.getPath(), manifestPath}); // NON-NLS
+ sysLogger.log(Level.WARNING, "Unsupported data source {0} for {1}", new Object[]{dataSource.getPath(), manifestPath}); // NON-NLS
return;
}
@@ -2486,7 +2487,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
DataSourceProcessorCallback callBack = new AddDataSourceCallback(caseForJob, dataSource, taskId, ingestLock);
caseForJob.notifyAddingDataSource(taskId);
jobLogger.logDataSourceProcessorSelected(selectedProcessor.getDataSourceType());
- SYS_LOGGER.log(Level.INFO, "Identified data source type for {0} as {1}", new Object[]{manifestPath, selectedProcessor.getDataSourceType()});
+ sysLogger.log(Level.INFO, "Identified data source type for {0} as {1}", new Object[]{manifestPath, selectedProcessor.getDataSourceType()});
selectedProcessor.process(dataSource.getDeviceId(), dataSource.getPath(), progressMonitor, callBack);
ingestLock.wait();
@@ -2504,7 +2505,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
return;
}
// If we get to this point, none of the processors were successful
- SYS_LOGGER.log(Level.SEVERE, "All data source processors failed to process {0}", dataSource.getPath());
+ sysLogger.log(Level.SEVERE, "All data source processors failed to process {0}", dataSource.getPath());
jobLogger.logFailedToAddDataSource();
setCaseNodeDataErrorsOccurred(caseDirectoryPath);
currentJob.setErrorsOccurred(true);
@@ -2547,7 +2548,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
case NONCRITICAL_ERRORS:
for (String errorMessage : dataSource.getDataSourceProcessorErrorMessages()) {
- SYS_LOGGER.log(Level.WARNING, "Non-critical error running data source processor for {0}: {1}", new Object[]{manifestPath, errorMessage});
+ sysLogger.log(Level.WARNING, "Non-critical error running data source processor for {0}: {1}", new Object[]{manifestPath, errorMessage});
}
jobLogger.logDataSourceAdded();
if (dataSource.getContent().isEmpty()) {
@@ -2557,7 +2558,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
case CRITICAL_ERRORS:
for (String errorMessage : dataSource.getDataSourceProcessorErrorMessages()) {
- SYS_LOGGER.log(Level.SEVERE, "Critical error running data source processor for {0}: {1}", new Object[]{manifestPath, errorMessage});
+ sysLogger.log(Level.SEVERE, "Critical error running data source processor for {0}: {1}", new Object[]{manifestPath, errorMessage});
}
jobLogger.logFailedToAddDataSource();
break;
@@ -2570,7 +2571,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* AutoIngestJob and calling cancel on the DSP, if not null, in
* cancelCurrentJob.
*/
- SYS_LOGGER.log(Level.WARNING, "Cancellation while waiting for data source processor for {0}", manifestPath);
+ sysLogger.log(Level.WARNING, "Cancellation while waiting for data source processor for {0}", manifestPath);
jobLogger.logDataSourceProcessorCancelled();
}
}
@@ -2595,7 +2596,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void analyze(AutoIngestDataSource dataSource) throws AnalysisStartupException, AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException {
Manifest manifest = currentJob.getManifest();
Path manifestPath = manifest.getFilePath();
- SYS_LOGGER.log(Level.INFO, "Starting ingest modules analysis for {0} ", manifestPath);
+ sysLogger.log(Level.INFO, "Starting ingest modules analysis for {0} ", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.ANALYZING_DATA_SOURCE, Date.from(Instant.now()));
Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath);
@@ -2616,17 +2617,17 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
* is shutting down.
*/
ingestLock.wait();
- SYS_LOGGER.log(Level.INFO, "Finished ingest modules analysis for {0} ", manifestPath);
+ sysLogger.log(Level.INFO, "Finished ingest modules analysis for {0} ", manifestPath);
IngestJob.ProgressSnapshot jobSnapshot = ingestJob.getSnapshot();
for (IngestJob.ProgressSnapshot.DataSourceProcessingSnapshot snapshot : jobSnapshot.getDataSourceSnapshots()) {
if (!snapshot.isCancelled()) {
List cancelledModules = snapshot.getCancelledDataSourceIngestModules();
if (!cancelledModules.isEmpty()) {
- SYS_LOGGER.log(Level.WARNING, String.format("Ingest module(s) cancelled for %s", manifestPath));
+ sysLogger.log(Level.WARNING, String.format("Ingest module(s) cancelled for %s", manifestPath));
currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath);
for (String module : snapshot.getCancelledDataSourceIngestModules()) {
- SYS_LOGGER.log(Level.WARNING, String.format("%s ingest module cancelled for %s", module, manifestPath));
+ sysLogger.log(Level.WARNING, String.format("%s ingest module cancelled for %s", module, manifestPath));
jobLogger.logIngestModuleCancelled(module);
}
}
@@ -2644,14 +2645,14 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
}
} else if (!ingestJobStartResult.getModuleErrors().isEmpty()) {
for (IngestModuleError error : ingestJobStartResult.getModuleErrors()) {
- SYS_LOGGER.log(Level.SEVERE, String.format("%s ingest module startup error for %s", error.getModuleDisplayName(), manifestPath), error.getThrowable());
+ sysLogger.log(Level.SEVERE, String.format("%s ingest module startup error for %s", error.getModuleDisplayName(), manifestPath), error.getThrowable());
}
currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath);
jobLogger.logIngestModuleStartupErrors();
throw new AnalysisStartupException(String.format("Error(s) during ingest module startup for %s", manifestPath));
} else {
- SYS_LOGGER.log(Level.SEVERE, String.format("Ingest manager ingest job start error for %s", manifestPath), ingestJobStartResult.getStartupException());
+ sysLogger.log(Level.SEVERE, String.format("Ingest manager ingest job start error for %s", manifestPath), ingestJobStartResult.getStartupException());
currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath);
jobLogger.logAnalysisStartupError();
@@ -2659,7 +2660,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
}
} else {
for (String warning : settingsWarnings) {
- SYS_LOGGER.log(Level.SEVERE, "Ingest job settings error for {0}: {1}", new Object[]{manifestPath, warning});
+ sysLogger.log(Level.SEVERE, "Ingest job settings error for {0}: {1}", new Object[]{manifestPath, warning});
}
currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath);
@@ -2732,7 +2733,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private void exportFiles(AutoIngestDataSource dataSource) throws FileExportException, AutoIngestJobLoggerException, InterruptedException, CaseNodeData.InvalidDataException, CoordinationServiceException {
Manifest manifest = currentJob.getManifest();
Path manifestPath = manifest.getFilePath();
- SYS_LOGGER.log(Level.INFO, "Exporting files for {0}", manifestPath);
+ sysLogger.log(Level.INFO, "Exporting files for {0}", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.EXPORTING_FILES, Date.from(Instant.now()));
Path caseDirectoryPath = currentJob.getCaseDirectoryPath();
AutoIngestJobLogger jobLogger = new AutoIngestJobLogger(manifestPath, manifest.getDataSourceFileName(), caseDirectoryPath);
@@ -2743,7 +2744,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
jobLogger.logFileExportCompleted();
}
} catch (FileExportException ex) {
- SYS_LOGGER.log(Level.SEVERE, String.format("Error doing file export for %s", manifestPath), ex);
+ sysLogger.log(Level.SEVERE, String.format("Error doing file export for %s", manifestPath), ex);
currentJob.setErrorsOccurred(true);
setCaseNodeDataErrorsOccurred(caseDirectoryPath);
jobLogger.logFileExportError();
@@ -2916,7 +2917,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
private final long MAX_SECONDS_WITHOUT_UPDATE = JOB_STATUS_EVENT_INTERVAL_SECONDS * MAX_MISSED_JOB_STATUS_UPDATES;
private PeriodicJobStatusEventTask() {
- SYS_LOGGER.log(Level.INFO, "Periodic status publishing task started");
+ sysLogger.log(Level.INFO, "Periodic status publishing task started");
}
@Override
@@ -2949,7 +2950,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
try {
StatusDatabaseLogger.logToStatusDatabase(message, isError);
} catch (SQLException | UserPreferencesException ex) {
- SYS_LOGGER.log(Level.WARNING, "Failed to update status database", ex);
+ sysLogger.log(Level.WARNING, "Failed to update status database", ex);
}
}
}
@@ -2975,7 +2976,7 @@ final class AutoIngestManager extends Observable implements PropertyChangeListen
}
} catch (Exception ex) {
- SYS_LOGGER.log(Level.SEVERE, "Unexpected exception in PeriodicJobStatusEventTask", ex); //NON-NLS
+ sysLogger.log(Level.SEVERE, "Unexpected exception in PeriodicJobStatusEventTask", ex); //NON-NLS
}
}
diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestSystemLogger.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestSystemLogger.java
index 184d5d350a..33c3c20c23 100644
--- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestSystemLogger.java
+++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestSystemLogger.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2015 Basis Technology Corp.
+ * Copyright 2015-2018 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,8 +25,8 @@ import java.sql.Timestamp;
import java.util.logging.FileHandler;
import java.util.logging.Formatter;
import java.util.logging.LogRecord;
-import java.util.logging.Logger;
import javax.annotation.concurrent.GuardedBy;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/**
@@ -37,7 +37,7 @@ final class AutoIngestSystemLogger {
private static final int LOG_SIZE = 50000000; // In bytes, zero is unlimited, set to roughly 10mb currently
private static final int LOG_FILE_COUNT = 10;
- private static final Logger LOGGER = Logger.getLogger("AutoIngest"); //NON-NLS
+ private static final Logger logger = Logger.getLogger("AutoIngest"); //NON-NLS
private static final String NEWLINE = System.lineSeparator();
@GuardedBy("AutoIngestSystemLogger")
private static boolean configured;
@@ -74,14 +74,14 @@ final class AutoIngestSystemLogger {
+ stackTrace;
}
});
- LOGGER.addHandler(fileHandler);
- LOGGER.setUseParentHandlers(false);
+ logger.addHandler(fileHandler);
+ logger.setUseParentHandlers(false);
} catch (SecurityException | IOException ex) {
throw new RuntimeException(String.format("Error initializing file handler for %s", logFilePath), ex); //NON-NLS
}
configured = true;
}
- return LOGGER;
+ return logger;
}
/**
diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/StatusDatabaseLogger.java b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/StatusDatabaseLogger.java
index 2fa6db1457..f8921e112d 100644
--- a/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/StatusDatabaseLogger.java
+++ b/Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/StatusDatabaseLogger.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2015 Basis Technology Corp.
+ * Copyright 2015-2018 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,6 +26,7 @@ import java.sql.Statement;
import java.util.logging.Level;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.core.UserPreferencesException;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.NetworkUtils;
import org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreferences;
@@ -33,72 +34,79 @@ import org.sleuthkit.autopsy.experimental.configuration.AutoIngestUserPreference
* Write auto-ingest status updates to a database.
*/
public class StatusDatabaseLogger {
+
/**
- * Log the current status to the database using the database
- * parameters saved in AutoIngestUserPreferences.
- * @param message Current status message
- * @param isError true if we're in an error state, false otherwise
- * @throws SQLException
+ * Log the current status to the database using the database parameters
+ * saved in AutoIngestUserPreferences.
+ *
+ * @param message Current status message
+ * @param isError true if we're in an error state, false otherwise
+ *
+ * @throws SQLException If a SQL data access error occurs.
+ * @throws UserPreferencesException If there's an issue reading the user
+ * preferences.
*/
- public static void logToStatusDatabase(String message, boolean isError) throws SQLException, UserPreferencesException{
-
- try{
+ public static void logToStatusDatabase(String message, boolean isError) throws SQLException, UserPreferencesException {
+
+ try {
Class.forName("org.postgresql.Driver");
- } catch (ClassNotFoundException ex){
- java.util.logging.Logger SYS_LOGGER = AutoIngestSystemLogger.getLogger();
- SYS_LOGGER.log(Level.WARNING, "Error loading postgresql driver", ex);
+ } catch (ClassNotFoundException ex) {
+ Logger sysLogger = AutoIngestSystemLogger.getLogger();
+ sysLogger.log(Level.WARNING, "Error loading postgresql driver", ex);
}
- try (Connection connection = DriverManager.getConnection("jdbc:postgresql://"
+ try (Connection connection = DriverManager.getConnection("jdbc:postgresql://"
+ AutoIngestUserPreferences.getLoggingDatabaseHostnameOrIP()
+ ":" + AutoIngestUserPreferences.getLoggingPort()
+ "/" + AutoIngestUserPreferences.getLoggingDatabaseName(),
- AutoIngestUserPreferences.getLoggingUsername(),
+ AutoIngestUserPreferences.getLoggingUsername(),
AutoIngestUserPreferences.getLoggingPassword());
Statement statement = connection.createStatement();) {
logToStatusDatabase(statement, message, isError);
}
}
-
+
/**
- * Log the current status to the database using an already
- * configured Statement.
+ * Log the current status to the database using an already configured
+ * Statement.
+ *
* @param statement SQL statement (must have already been created)
* @param message Current status message
* @param isError true if we're in an error state, false otherwise
- * @throws SQLException
+ *
+ * @throws SQLException
*/
- public static void logToStatusDatabase(Statement statement, String message, boolean isError) throws SQLException{
- if((statement == null) || statement.isClosed()){
+ public static void logToStatusDatabase(Statement statement, String message, boolean isError) throws SQLException {
+ if ((statement == null) || statement.isClosed()) {
throw new SQLException("SQL Statement is null/closed");
}
-
+
int status;
- if(isError){
+ if (isError) {
status = 1;
} else {
status = 0;
}
- String timestamp = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new java.util.Date());
+ String timestamp = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format( new java.util.Date());
- String checkForPreviousEntry = "SELECT * FROM statusUpdates WHERE tool='" + UserPreferences.getAppName() + "' AND " +
- "node='" + NetworkUtils.getLocalHostName() + "'";
+ String checkForPreviousEntry = "SELECT * FROM statusUpdates WHERE tool='" + UserPreferences.getAppName() + "' AND "
+ + "node='" + NetworkUtils.getLocalHostName() + "'";
ResultSet resultSet = statement.executeQuery(checkForPreviousEntry);
String logMessage;
- if(resultSet.next()){
- logMessage = "UPDATE statusUpdates SET reportTime='" + timestamp +
- "', message='" + message + "', status=" + status
+ if (resultSet.next()) {
+ logMessage = "UPDATE statusUpdates SET reportTime='" + timestamp
+ + "', message='" + message + "', status=" + status
+ " WHERE tool='" + UserPreferences.getAppName() + "' AND node='" + NetworkUtils.getLocalHostName() + "'";
} else {
- logMessage = "INSERT INTO statusUpdates (tool, node, reportTime, message, status) " +
- "VALUES ('" + UserPreferences.getAppName()
- + "', '" + NetworkUtils.getLocalHostName() +
- "', '" +
- timestamp + "', '" + message + "', '" + status + "')";
+ logMessage = "INSERT INTO statusUpdates (tool, node, reportTime, message, status) "
+ + "VALUES ('" + UserPreferences.getAppName()
+ + "', '" + NetworkUtils.getLocalHostName()
+ + "', '"
+ + timestamp + "', '" + message + "', '" + status + "')";
}
- statement.execute(logMessage);
+ statement.execute(logMessage);
}
}
diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/volatilityDSP/VolatilityProcessor.java b/Experimental/src/org/sleuthkit/autopsy/experimental/volatilityDSP/VolatilityProcessor.java
index fd285ae1aa..50246f5255 100644
--- a/Experimental/src/org/sleuthkit/autopsy/experimental/volatilityDSP/VolatilityProcessor.java
+++ b/Experimental/src/org/sleuthkit/autopsy/experimental/volatilityDSP/VolatilityProcessor.java
@@ -136,7 +136,6 @@ class VolatilityProcessor {
break;
}
String pluginToRun = pluginsToRun.get(i);
- progressMonitor.setProgressText(Bundle.VolatilityProcessor_progressMessage_runningImageInfo(pluginToRun));
runVolatilityPlugin(pluginToRun);
progressMonitor.setProgress(i);
}
@@ -172,6 +171,8 @@ class VolatilityProcessor {
"VolatilityProcessor_exceptionMessage_errorIndexingOutput=Error indexing output for {0} plugin"
})
private void runVolatilityPlugin(String pluginToRun) throws VolatilityProcessorException {
+ progressMonitor.setProgressText("Running module " + pluginToRun);
+
List commandLine = new ArrayList<>();
commandLine.add("\"" + executableFile + "\""); //NON-NLS
File memoryImage = new File(memoryImagePath);
@@ -314,6 +315,8 @@ class VolatilityProcessor {
String filePath = volfile.getParent();
+ logger.log(Level.INFO, "Looking up file " + fileName + " at path " + filePath);
+
try {
List resolvedFiles;
if (filePath == null) {
@@ -333,12 +336,13 @@ class VolatilityProcessor {
}
fileName += ".%"; //NON-NLS
+ logger.log(Level.INFO, "Looking up file (extension wildcard) " + fileName + " at path " + filePath);
+
if (filePath == null) {
resolvedFiles = fileManager.findFiles(fileName); //NON-NLS
} else {
resolvedFiles = fileManager.findFiles(fileName, filePath); //NON-NLS
}
-
}
if (resolvedFiles.isEmpty()) {
@@ -387,6 +391,7 @@ class VolatilityProcessor {
* @param pluginOutputFile File that contains the output to parse.
*/
private void createArtifactsFromPluginOutput(String pluginName, File pluginOutputFile) throws VolatilityProcessorException {
+ progressMonitor.setProgressText("Parsing module " + pluginName);
Set fileSet = null;
switch (pluginName) {
case "dlllist": //NON-NLS
@@ -421,6 +426,7 @@ class VolatilityProcessor {
}
if (fileSet != null && !fileSet.isEmpty()) {
+ progressMonitor.setProgressText("Flagging files from module " + pluginName);
flagFiles(fileSet, pluginName);
}
}
diff --git a/KeywordSearch/build.xml b/KeywordSearch/build.xml
index 5fe021fff8..5066a8e051 100644
--- a/KeywordSearch/build.xml
+++ b/KeywordSearch/build.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearch.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearch.java
index b09ad5430e..b988dd4e49 100644
--- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearch.java
+++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearch.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2011-2017 Basis Technology Corp.
+ * Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,10 +23,10 @@ import java.beans.PropertyChangeSupport;
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
-import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
@@ -39,8 +39,8 @@ public class KeywordSearch {
private static Server server;
//we want a custom java.util.logging.Logger here for a reason
//a separate logger from framework logs
- private static final Logger TIKA_LOGGER = Logger.getLogger("Tika"); //NON-NLS
- private static final org.sleuthkit.autopsy.coreutils.Logger logger = org.sleuthkit.autopsy.coreutils.Logger.getLogger(Case.class.getName());
+ private static final java.util.logging.Logger tikaLogger = java.util.logging.Logger.getLogger("Tika"); //NON-NLS
+ private static final Logger logger = Logger.getLogger(Case.class.getName());
// @@@ We should move this into TskData (or somewhere) because we are using
// this value in the results tree to display substring differently from regexp (KeywordHit.java)
@@ -70,9 +70,9 @@ public class KeywordSearch {
0, MAX_TIKA_LOG_FILES);
tikaLogHandler.setFormatter(new SimpleFormatter());
tikaLogHandler.setEncoding(PlatformUtil.getLogFileEncoding());
- TIKA_LOGGER.addHandler(tikaLogHandler);
+ tikaLogger.addHandler(tikaLogHandler);
//do not forward to the parent autopsy logger
- TIKA_LOGGER.setUseParentHandlers(false);
+ tikaLogger.setUseParentHandlers(false);
} catch (IOException | SecurityException ex) {
logger.log(Level.SEVERE, "Error setting up tika logging", ex); //NON-NLS
}
@@ -83,8 +83,8 @@ public class KeywordSearch {
throw new AssertionError();
}
- static Logger getTikaLogger() {
- return TIKA_LOGGER;
+ static java.util.logging.Logger getTikaLogger() {
+ return tikaLogger;
}
public static void addNumIndexedFilesChangeListener(PropertyChangeListener l) {
diff --git a/RecentActivity/build.xml b/RecentActivity/build.xml
index f64b4191ca..af346f58e7 100644
--- a/RecentActivity/build.xml
+++ b/RecentActivity/build.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java b/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java
index d1860120a6..96f7d18fa3 100644
--- a/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java
+++ b/Testing/src/org/sleuthkit/autopsy/testing/AutopsyTestCases.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2011-2017 Basis Technology Corp.
+ * Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java
index 0518da865b..8f1ef48a4c 100644
--- a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java
+++ b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2011-2017 Basis Technology Corp.
+ * Copyright 2011-2018 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,7 +41,7 @@ import org.netbeans.junit.NbModuleSuite;
public class RegressionTest extends TestCase {
private static final Logger logger = Logger.getLogger(RegressionTest.class.getName());
- private static AutopsyTestCases autopsyTests = new AutopsyTestCases(Boolean.parseBoolean(System.getProperty("isMultiUser")));
+ private static final AutopsyTestCases autopsyTests = new AutopsyTestCases(Boolean.parseBoolean(System.getProperty("isMultiUser")));
/**
* Constructor required by JUnit
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000000..8911def936
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,51 @@
+version: 4.6.0.{build}
+
+cache:
+ - C:\Users\appveyor\.ant -> appveyor.yml
+ - C:\Users\appveyor\.ivy2 -> appveyor.yml
+ - C:\ProgramData\chocolatey\bin -> appveyor.yml
+ - C:\ProgramData\chocolatey\lib -> appveyor.yml
+
+branches:
+ only:
+ - develop
+
+image: Visual Studio 2015
+platform: x64
+init:
+ - ps: choco install ant --ignore-dependencies
+ - ps: $env:Path="C:\Program Files\Java\jdk1.8.0\bin;$($env:Path);C:\ProgramData\chocolatey\lib\ant"
+ - set PATH=C:\Python36-x64\';%PATH%
+environment:
+ global:
+ TSK_HOME: "C:\\sleuthkit"
+ LIBVHDI_HOME: "C:\\libvhdi_64bit"
+ LIBVMDK_HOME: "C:\\libvmdk_64bit\\libvmdk"
+ LIBEWF_HOME: "C:\\libewf_64bit"
+ POSTGRESQL_HOME_64: "C:\\Program Files\\PostgreSQL\\9.5"
+ JDK_HOME: C:\Program Files\Java\jdk1.8.0
+ PYTHON: "C:\\Python36-x64"
+
+install:
+ - ps: pushd C:\
+ - git clone https://github.com/sleuthkit/sleuthkit
+ - ps: popd
+services:
+ - postgresql95
+
+
+build_script:
+ - cd %TSK_HOME%
+ - python setupLibs.py
+ - python win32\updateBuildLibs.py -m
+ - ps: pushd bindings/java
+ - ps: ant -version
+ - cmd: ant dist-PostgreSQL
+ - ps: popd
+ - cd %APPVEYOR_BUILD_FOLDER%
+ - cmd: ant -q build
+ - cd Core
+ - cmd: ant -q test
+ - cd ..
+
+test: off