Skip to content

Commit

Permalink
eve/watcher: display warning if parent directory not readable
Browse files Browse the repository at this point in the history
The user may point EveBox at files in a directory that is not
readable. If the parent directory of the files are not readable,
display a warning.
  • Loading branch information
jasonish committed Mar 25, 2024
1 parent 56440a9 commit 5de73ff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/eve/watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ impl EvePatternWatcher {

pub fn check(&mut self) {
for pattern in &self.patterns {
// This is for error reporting to the user, in the case
// where the parent directory of the log files is not
// readable by EveBox.
if let Some(p) = PathBuf::from(pattern).parent() {
if let Err(err) = std::fs::read_dir(p) {
warn!(
"Failed to read directory {}, EVE log files are likely unreadable: {}",
p.display(),
err
);
}
}
if let Ok(paths) = crate::path::expand(pattern) {
for path in paths {
if !self.filenames.contains(&path) {
Expand Down

0 comments on commit 5de73ff

Please sign in to comment.