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() {
112 if (timerAction == null) {
113 timerAction =
new MonitorTimerAction();
117 }
catch (SecurityException e) {
118 logger.log(Level.WARNING,
"Error checking for free disk space on ingest data drive", e);
136 AutopsyEvent
event = (AutopsyEvent) evt;
137 if (AutopsyEvent.SourceType.LOCAL == event.getSourceType() &&
event.getPropertyName().equals(
Case.
Events.
CURRENT_CASE.toString())) {
142 if (null != evt.getNewValue()) {
163 root =
new File(File.separator);
176 File parentDir = curDir.getParentFile();
177 while (null != parentDir) {
179 parentDir = curDir.getParentFile();
190 logger.log(Level.INFO,
"Monitoring disk space of {0}", root.getAbsolutePath());
209 String diskPath = root.getAbsolutePath();
211 NbBundle.getMessage(
this.getClass(),
"IngestMonitor.mgrErrMsg.lowDiskSpace.title", diskPath),
212 NbBundle.getMessage(
this.getClass(),
"IngestMonitor.mgrErrMsg.lowDiskSpace.msg", diskPath)));
213 monitorLogger.log(Level.SEVERE,
"Stopping ingest due to low disk space on {0}", diskPath);
214 logger.log(Level.SEVERE,
"Stopping ingest due to low disk space on {0}", diskPath);
230 final long freeSpace = root.getFreeSpace();
231 logger.log(Level.INFO,
"Available disk space on drive where case dir resides is {0} (bytes)", freeSpace);
244 }
catch (SecurityException e) {
245 logger.log(Level.WARNING,
"Unable to check for free disk space (permission issue)", e);
249 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
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 Case getCurrentCaseThrows()
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()