file.truncate()
except Exception as e:
print("Exception while updating bookmark file:", e)
return None
# Call filter_log_data to filter the copied data
filtered_filename = filter_log_data(filename)
# Compress the output file and remove the uncompressed file
output_file_name = output_file.name
new_output_file_name = output_file_name.replace('.txt', '-cassandra.log')
os.rename(output_file_name, new_output_file_name)
try:
with open(new_output_file_name, 'rb') as input_file, gzip.open(new_output_file_name + '.gz', 'wb') as output_file_gz:
input_data = input_file.read()
output_file_gz.write(input_data)
os.remove(new_output_file_name)
# Set permissions on the output file
os.chmod(output_file_gz.name, 0o777)
except Exception as e:
print("Exception while compressing file:", e)
# Return the filtered filename
return filtered_filename