diff --git a/server/filter.py b/server/filter.py index 38151d90..d170709e 100644 --- a/server/filter.py +++ b/server/filter.py @@ -446,7 +446,7 @@ class FileFilter(Filter): # In order to detect log rotation, the hash (MD5) of the first line of the file # is computed and compared to the previous hash of this line. -import md5 +import hashlib class FileContainer: @@ -461,7 +461,7 @@ class FileContainer: try: firstLine = handler.readline() # Computes the MD5 of the first line. - self.__hash = md5.new(firstLine).digest() + self.__hash = hashlib.md5(firstLine).digest() # Start at the beginning of file if tail mode is off. if tail: handler.seek(0, 2) @@ -481,7 +481,7 @@ class FileContainer: fcntl.fcntl(fd, fcntl.F_SETFD, fd | fcntl.FD_CLOEXEC) firstLine = self.__handler.readline() # Computes the MD5 of the first line. - myHash = md5.new(firstLine).digest() + myHash = hashlib.md5(firstLine).digest() stats = os.fstat(self.__handler.fileno()) # Compare hash and inode if self.__hash != myHash or self.__ino != stats.st_ino: