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;
54 private static final java.util.logging.Logger
monitorLogger = java.util.logging.
Logger.getLogger(
"monitor");
69 monitorLogHandler.setFormatter(
new SimpleFormatter());
73 }
catch (IOException | SecurityException ex) {
74 logger.log(Level.SEVERE,
"Failed to create memory usage logger", ex);
82 timerAction =
new MonitorTimerAction();
83 timer =
new Timer(INITIAL_INTERVAL_MS, timerAction);
101 boolean isRunning() {
102 return (null != timer && timer.isRunning());
111 long getFreeSpace() {
114 }
catch (SecurityException e) {
115 logger.log(Level.WARNING,
"Error checking for free disk space on ingest data drive", e);
133 AutopsyEvent
event = (AutopsyEvent) evt;
134 if (AutopsyEvent.SourceType.LOCAL == event.getSourceType() &&
event.getPropertyName().equals(
Case.
Events.
CURRENT_CASE.toString())) {
139 if (null != evt.getNewValue()) {
160 root =
new File(File.separator);
173 File parentDir = curDir.getParentFile();
174 while (null != parentDir) {
176 parentDir = curDir.getParentFile();
187 logger.log(Level.INFO,
"Monitoring disk space of {0}", root.getAbsolutePath());
206 String diskPath = root.getAbsolutePath();
208 NbBundle.getMessage(
this.getClass(),
"IngestMonitor.mgrErrMsg.lowDiskSpace.title", diskPath),
209 NbBundle.getMessage(
this.getClass(),
"IngestMonitor.mgrErrMsg.lowDiskSpace.msg", diskPath)));
210 monitorLogger.log(Level.SEVERE,
"Stopping ingest due to low disk space on {0}", diskPath);
211 logger.log(Level.SEVERE,
"Stopping ingest due to low disk space on {0}", diskPath);
227 final long freeSpace = root.getFreeSpace();
228 logger.log(Level.INFO,
"Available disk space on drive where case dir resides is {0} (bytes)", freeSpace);
241 }
catch (SecurityException e) {
242 logger.log(Level.WARNING,
"Unable to check for free disk space (permission issue)", e);
246 if (freeSpace == DISK_FREE_SPACE_UNKNOWN) {
static final long MIN_FREE_DISK_SPACE
static synchronized IngestManager getInstance()
void logMonitoredRootDirectory()
String getCaseDirectory()
static Case getOpenCase()
boolean isIngestRunning()
MonitorTimerAction timerAction
static final java.util.logging.Logger monitorLogger
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
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 synchronized IngestServices getInstance()