From ce99b0e85a5adf422bc7374b901ddbd055ba32d0 Mon Sep 17 00:00:00 2001 From: lovesh-ap Date: Wed, 6 Nov 2024 11:48:22 +0530 Subject: [PATCH] delete rollover log files with specific prefix and suffix --- .../agent/security/intcodeagent/filelogging/LogFileHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newrelic-security-agent/src/main/java/com/newrelic/agent/security/intcodeagent/filelogging/LogFileHelper.java b/newrelic-security-agent/src/main/java/com/newrelic/agent/security/intcodeagent/filelogging/LogFileHelper.java index 1b32f3afb..5a5d12431 100644 --- a/newrelic-security-agent/src/main/java/com/newrelic/agent/security/intcodeagent/filelogging/LogFileHelper.java +++ b/newrelic-security-agent/src/main/java/com/newrelic/agent/security/intcodeagent/filelogging/LogFileHelper.java @@ -72,7 +72,7 @@ public static boolean isDailyRollover() { } public static void deleteRolloverLogFiles(String fileName, long max) { - Collection rolloverLogFiles = FileUtils.listFiles(new File(OsVariablesInstance.getInstance().getOsVariables().getLogDirectory()), FileFilterUtils.prefixFileFilter(fileName + "."), null); + Collection rolloverLogFiles = FileUtils.listFiles(new File(OsVariablesInstance.getInstance().getOsVariables().getLogDirectory()), FileFilterUtils.and(FileFilterUtils.prefixFileFilter(fileName + "."), FileFilterUtils.suffixFileFilter(".log")), null); if (rolloverLogFiles.size() > max) { File[] sortedLogFiles = rolloverLogFiles.toArray(new File[0]);