[ 
https://issues.apache.org/jira/browse/AMBARI-24833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16691756#comment-16691756
 ] 

ASF GitHub Bot commented on AMBARI-24833:
-----------------------------------------

oleewere closed pull request #28: AMBARI-24833. Use seconds instead of minutes 
for cloud log threshold
URL: https://github.com/apache/ambari-logsearch/pull/28
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
index a15ac7468a..1b0aa534d6 100644
--- 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
+++ 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/common/LogFeederConstants.java
@@ -117,7 +117,7 @@
   public static final String CLOUD_STORAGE_BASE_PATH = 
"logfeeder.cloud.storage.base.path";
 
   public static final String CLOUD_ROLLOVER_ARCHIVE_LOCATION = 
"logfeeder.cloud.rollover.archive.base.dir";
-  public static final String CLOUD_ROLLOVER_THRESHOLD_TIME_MIN = 
"logfeeder.cloud.rollover.threshold.min";
+  public static final String CLOUD_ROLLOVER_THRESHOLD_TIME_SECONDS = 
"logfeeder.cloud.rollover.threshold.min";
   public static final String CLOUD_ROLLOVER_THRESHOLD_TIME_SIZE = 
"logfeeder.cloud.rollover.threshold.size";
   public static final String CLOUD_ROLLOVER_MAX_BACKUP_FILES = 
"logfeeder.cloud.rollover.max.files";
   public static final String CLOUD_ROLLOVER_THRESHOLD_TIME_SIZE_UNIT = 
"logfeeder.cloud.rollover.threshold.size.unit";
diff --git 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/output/RolloverConfig.java
 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/output/RolloverConfig.java
index 282792ae86..bdc908bd5e 100644
--- 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/output/RolloverConfig.java
+++ 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/conf/output/RolloverConfig.java
@@ -37,14 +37,14 @@
   private String rolloverArchiveBaseDir;
 
   @LogSearchPropertyDescription(
-    name = LogFeederConstants.CLOUD_ROLLOVER_THRESHOLD_TIME_MIN,
-    description = "Rollover cloud log files after an interval (minutes)",
-    examples = {"1"},
-    defaultValue = "60",
+    name = LogFeederConstants.CLOUD_ROLLOVER_THRESHOLD_TIME_SECONDS,
+    description = "Rollover cloud log files after an interval (seconds)",
+    examples = {"60"},
+    defaultValue = "3600",
     sources = {LogFeederConstants.LOGFEEDER_PROPERTIES_FILE}
   )
-  @Value("${"+ LogFeederConstants.CLOUD_ROLLOVER_THRESHOLD_TIME_MIN + ":60}")
-  private int rolloverThresholdTimeMins;
+  @Value("${"+ LogFeederConstants.CLOUD_ROLLOVER_THRESHOLD_TIME_SECONDS + 
":3600}")
+  private int rolloverThresholdTimeSeconds;
 
   @LogSearchPropertyDescription(
     name = LogFeederConstants.CLOUD_ROLLOVER_THRESHOLD_TIME_SIZE,
@@ -116,12 +116,12 @@
   @Value("${"+ LogFeederConstants.CLOUD_ROLLOVER_ON_STARTUP + ":false}")
   private boolean rolloverOnStartup;
 
-  public int getRolloverThresholdTimeMins() {
-    return rolloverThresholdTimeMins;
+  public int getRolloverThresholdTimeSeconds() {
+    return rolloverThresholdTimeSeconds;
   }
 
-  public void setRolloverThresholdTimeMins(int rolloverThresholdTimeMins) {
-    this.rolloverThresholdTimeMins = rolloverThresholdTimeMins;
+  public void setRolloverThresholdTimeSeconds(int 
rolloverThresholdTimeSeconds) {
+    this.rolloverThresholdTimeSeconds = rolloverThresholdTimeSeconds;
   }
 
   public Integer getRolloverMaxBackupFiles() {
diff --git 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/cloud/CloudStorageLoggerFactory.java
 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/cloud/CloudStorageLoggerFactory.java
index 0cfdbcc1e2..d39349f4d1 100644
--- 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/cloud/CloudStorageLoggerFactory.java
+++ 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/cloud/CloudStorageLoggerFactory.java
@@ -78,7 +78,7 @@ public static Logger createLogger(Input input, LoggerContext 
loggerContext, LogF
     String rolloverSize = 
logFeederProps.getRolloverConfig().getRolloverSize().toString() + 
logFeederProps.getRolloverConfig().getRolloverSizeFormat();
     SizeBasedTriggeringPolicy sizeBasedTriggeringPolicy = 
SizeBasedTriggeringPolicy.createPolicy(rolloverSize);
     CustomTimeBasedTriggeringPolicy customTimeBasedTriggeringPolicy = 
CustomTimeBasedTriggeringPolicy
-      
.createPolicy(String.valueOf(logFeederProps.getRolloverConfig().getRolloverThresholdTimeMins()));
+      
.createPolicy(String.valueOf(logFeederProps.getRolloverConfig().getRolloverThresholdTimeSeconds()));
 
     final CompositeTriggeringPolicy compositeTriggeringPolicy;
 
diff --git 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/cloud/CustomTimeBasedTriggeringPolicy.java
 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/cloud/CustomTimeBasedTriggeringPolicy.java
index 41bb5ba646..77e686e5ef 100644
--- 
a/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/cloud/CustomTimeBasedTriggeringPolicy.java
+++ 
b/ambari-logsearch-logfeeder/src/main/java/org/apache/ambari/logfeeder/output/cloud/CustomTimeBasedTriggeringPolicy.java
@@ -34,17 +34,17 @@
 @Plugin(name = "CustomTimeBasedTriggeringPolicy", category = 
Core.CATEGORY_NAME, printObject = true)
 public final class CustomTimeBasedTriggeringPolicy extends 
AbstractTriggeringPolicy {
 
-  private final long intervalMin;
+  private final long intervalSeconds;
 
   private RollingFileManager manager;
   private long nextRolloverMillis;
 
-  private CustomTimeBasedTriggeringPolicy(final long intervalMin) {
-    this.intervalMin = intervalMin;
+  private CustomTimeBasedTriggeringPolicy(final long intervalSeconds) {
+    this.intervalSeconds = intervalSeconds;
   }
 
-  public long getIntervalMin() {
-    return this.intervalMin;
+  public long getIntervalSeconds() {
+    return this.intervalSeconds;
   }
 
   @Override
@@ -53,7 +53,7 @@ public void initialize(RollingFileManager manager) {
     long fileTime = this.manager.getFileTime();
     long actualDate = System.currentTimeMillis();
     long diff = actualDate - fileTime;
-    long intervalMillis = TimeUnit.MINUTES.toMillis(this.intervalMin);
+    long intervalMillis = TimeUnit.SECONDS.toMillis(this.intervalSeconds);
     if (diff > intervalMillis) {
       this.nextRolloverMillis = actualDate;
     } else {
@@ -69,7 +69,7 @@ public boolean isTriggeringEvent(LogEvent event) {
     } else {
       long nowMillis = event.getTimeMillis();
       if (nowMillis >= this.nextRolloverMillis) {
-        this.nextRolloverMillis = nowMillis + 
TimeUnit.MINUTES.toMillis(this.intervalMin);
+        this.nextRolloverMillis = nowMillis + 
TimeUnit.SECONDS.toMillis(this.intervalSeconds);
         return true;
       } else {
         return false;
@@ -78,8 +78,8 @@ public boolean isTriggeringEvent(LogEvent event) {
   }
 
   @PluginFactory
-  public static CustomTimeBasedTriggeringPolicy 
createPolicy(@PluginAttribute("intervalMins") final String intervalMins) {
-    return new CustomTimeBasedTriggeringPolicy(Long.parseLong(intervalMins));
+  public static CustomTimeBasedTriggeringPolicy 
createPolicy(@PluginAttribute("intervalSeconds") final String intervalSeconds) {
+    return new 
CustomTimeBasedTriggeringPolicy(Long.parseLong(intervalSeconds));
   }
 
 }
diff --git a/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties 
b/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties
index 45c05f39cf..56906adc3a 100644
--- a/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties
+++ b/ambari-logsearch-logfeeder/src/main/resources/logfeeder.properties
@@ -53,7 +53,7 @@ logfeeder.cloud.storage.bucket=logfeeder
 logfeeder.cloud.storage.bucket.bootstrap=true
 
 logfeeder.cloud.rollover.archive.base.dir=target/tmp
-logfeeder.cloud.rollover.threshold.min=1000
+logfeeder.cloud.rollover.threshold.seconds=120
 logfeeder.cloud.rollover.threshold.size=1
 logfeeder.cloud.rollover.threshold.size.unit=K
 logfeeder.cloud.rollover.immediate.flush=true


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Log Feeder: send logs to cloud storage (gcs/s3 etc.)
> ----------------------------------------------------
>
>                 Key: AMBARI-24833
>                 URL: https://issues.apache.org/jira/browse/AMBARI-24833
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-logsearch
>    Affects Versions: 2.7.0
>            Reporter: Olivér Szabó
>            Assignee: Olivér Szabó
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 2.8.0
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to