mirror of
https://github.com/Febbweiss/logstash-forwarder-java.git
synced 2026-03-05 06:35:44 +00:00
Implemented tail option.
This commit is contained in:
@@ -43,6 +43,7 @@ public class FileWatcher {
|
||||
private Map<File,FileState> newWatchMap = new HashMap<File,FileState>();
|
||||
private FileState[] savedStates;
|
||||
private int maxSignatureLength;
|
||||
private boolean tail = false;
|
||||
|
||||
public FileWatcher() {
|
||||
try {
|
||||
@@ -60,6 +61,13 @@ public class FileWatcher {
|
||||
}
|
||||
}
|
||||
processModifications();
|
||||
if(tail) {
|
||||
for(FileState state : oldWatchMap.values()) {
|
||||
if(state.getPointer() == 0) {
|
||||
state.setPointer(state.getSize());
|
||||
}
|
||||
}
|
||||
}
|
||||
printWatchMap();
|
||||
}
|
||||
|
||||
@@ -324,4 +332,8 @@ public class FileWatcher {
|
||||
this.maxSignatureLength = maxSignatureLength;
|
||||
}
|
||||
|
||||
public void setTail(boolean tail) {
|
||||
this.tail = tail;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user