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.EnumSet;
27 import java.util.logging.FileHandler;
28 import java.util.logging.Level;
29 import java.util.logging.SimpleFormatter;
30 import org.openide.util.NbBundle;
32 import javax.swing.Timer;
48 private static final java.util.logging.Logger
MONITOR_LOGGER = java.util.logging.
Logger.getLogger(
"monitor");
63 monitorLogHandler.setFormatter(
new SimpleFormatter());
67 }
catch (IOException | SecurityException ex) {
68 logger.log(Level.SEVERE,
"Failed to create memory usage logger", ex);
76 timerAction =
new MonitorTimerAction();
77 timer =
new Timer(INITIAL_INTERVAL_MS, timerAction);
96 return (null != timer && timer.isRunning());
105 long getFreeSpace() {
108 }
catch (SecurityException e) {
109 logger.log(Level.WARNING,
"Error checking for free disk space on ingest data drive", e);
127 AutopsyEvent
event = (AutopsyEvent) evt;
128 if (AutopsyEvent.SourceType.LOCAL == event.getSourceType() &&
event.getPropertyName().equals(
Case.
Events.
CURRENT_CASE.toString())) {
133 if (null != evt.getNewValue()) {
149 }
catch (IllegalStateException unused) {
154 root =
new File(File.separator);
167 File parentDir = curDir.getParentFile();
168 while (null != parentDir) {
170 parentDir = curDir.getParentFile();
181 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);
220 final long freeSpace = root.getFreeSpace();
221 logger.log(Level.INFO,
"Available disk space on drive where case dir resides is {0} (bytes)", freeSpace);
234 }
catch (SecurityException e) {
235 logger.log(Level.WARNING,
"Unable to check for free disk space (permission issue)", e);
239 if (freeSpace == DISK_FREE_SPACE_UNKNOWN) {
static final long MIN_FREE_DISK_SPACE
static synchronized IngestManager getInstance()
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 void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static final int MAX_LOG_FILES
void cancelAllIngestJobs(IngestJob.CancellationReason reason)
void actionPerformed(ActionEvent e)
static final java.util.logging.Logger MONITOR_LOGGER
static synchronized IngestServices getInstance()