19 package org.sleuthkit.autopsy.ingest;
21 import java.awt.event.ActionEvent;
22 import java.awt.event.ActionListener;
23 import java.beans.PropertyChangeEvent;
25 import java.io.IOException;
26 import java.util.logging.FileHandler;
27 import java.util.logging.Level;
28 import java.util.logging.SimpleFormatter;
29 import org.openide.util.NbBundle;
31 import javax.swing.Timer;
47 private static final java.util.logging.Logger
MONITOR_LOGGER = java.util.logging.
Logger.getLogger(
"monitor");
62 monitorLogHandler.setFormatter(
new SimpleFormatter());
66 }
catch (IOException | SecurityException ex) {
67 logger.log(Level.SEVERE,
"Failed to create memory usage logger", ex);
75 timerAction =
new MonitorTimerAction();
76 timer =
new Timer(INITIAL_INTERVAL_MS, timerAction);
95 return (null != timer && timer.isRunning());
104 long getFreeSpace() {
107 }
catch (SecurityException e) {
108 logger.log(Level.WARNING,
"Error checking for free disk space on ingest data drive", e);
126 AutopsyEvent
event = (AutopsyEvent) evt;
127 if (AutopsyEvent.SourceType.LOCAL == event.getSourceType() &&
event.getPropertyName().equals(
Case.
Events.
CURRENT_CASE.toString())) {
132 if (null != evt.getNewValue()) {
148 }
catch (IllegalStateException unused) {
153 root =
new File(File.separator);
166 File parentDir = curDir.getParentFile();
167 while (null != parentDir) {
169 parentDir = curDir.getParentFile();
180 logger.log(Level.INFO,
"Monitoring disk space of {0}", root.getAbsolutePath());
200 String diskPath = root.getAbsolutePath();
202 NbBundle.getMessage(
this.getClass(),
"IngestMonitor.mgrErrMsg.lowDiskSpace.title", diskPath),
203 NbBundle.getMessage(
this.getClass(),
"IngestMonitor.mgrErrMsg.lowDiskSpace.msg", diskPath)));
204 MONITOR_LOGGER.log(Level.SEVERE,
"Stopping ingest due to low disk space on {0}", diskPath);
205 logger.log(Level.SEVERE,
"Stopping ingest due to low disk space on {0}", diskPath);
226 }
catch (SecurityException e) {
227 logger.log(Level.WARNING,
"Unable to check for free disk space (permission issue)", e);
231 if (freeSpace == DISK_FREE_SPACE_UNKNOWN) {
245 final long freeSpace = root.getFreeSpace();
246 if (0 == freeSpace) {
251 final String monitoredPath = root.getAbsolutePath();
252 if (monitoredPath.startsWith(
"\\\\") || monitoredPath.startsWith(
"//")) {
static final long MIN_FREE_DISK_SPACE
static synchronized IngestManager getInstance()
void cancelAllIngestJobs()
void logMonitoredRootDirectory()
String getCaseDirectory()
boolean isIngestRunning()
MonitorTimerAction timerAction
void findRootDirectoryForCurrentCase(Case currentCase)
Logger(String name, String resourceBundleName)
void findRootDirectoryForCurrentCase()
static final int DISK_FREE_SPACE_UNKNOWN
boolean enoughDiskSpace()
void postMessage(final IngestMessage message)
static final int INITIAL_INTERVAL_MS
static Case getCurrentCase()
synchronized static Logger getLogger(String name)
static final int MAX_LOG_FILES
void actionPerformed(ActionEvent e)
static final java.util.logging.Logger MONITOR_LOGGER
static void addEventSubscriber(Set< String > eventNames, PropertyChangeListener subscriber)
static synchronized IngestServices getInstance()