apache/hadoop · error · MetricsException
Unrecognized unit for flush interval: ${flushUnit}. Must be
Error message
Unrecognized unit for flush interval: ${flushUnit}. Must be one of: minute, hour, day What it means
The optional unit suffix of roll-interval must be one of the recognized minute/hour/day spellings, case-insensitive with abbreviations and plurals: m/min/minute/minutes, h/hr/hour/hours, d/day/days. Any other alphabetic suffix reaches the switch default and throws MetricsException("Unrecognized unit for flush interval: <unit>"). Notably there is deliberately NO second unit — the smallest legal interval is one minute.
Source
Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/metrics2/sink/RollingFileSystemSink.java:383
case "m":
case "min":
case "minute":
case "minutes":
millis = TimeUnit.MINUTES.toMillis(rollIntervalInt);
break;
case "h":
case "hr":
case "hour":
case "hours":
millis = TimeUnit.HOURS.toMillis(rollIntervalInt);
break;
case "d":
case "day":
case "days":
millis = TimeUnit.DAYS.toMillis(rollIntervalInt);
break;
default:
throw new MetricsException("Unrecognized unit for flush interval: "
+ flushUnit + ". Must be one of: minute, hour, day");
}
}
} else {
throw new MetricsException("Unrecognized flush interval: "
+ rollInterval + ". Must be a number followed by an optional unit."
+ " The unit must be one of: minute, hour, day");
}
if (millis < 60000) {
throw new MetricsException("The flush interval property must be "
+ "at least 1 minute. Value was " + rollInterval);
}
return millis;
}
/**View on GitHub (pinned to 2add963021)
Solutions
- Express the interval using an allowed unit: 30minutes, 2hours, 1day (or abbreviations 30min, 2h, 1d)
- Sub-minute intervals are impossible — the sink enforces a 1-minute minimum by design
- Check for accidental characters after the unit (e.g. '1hour,')
Example fix
# before *.sink.rolling.roll-interval=90seconds # 'seconds' is not a recognized unit # after *.sink.rolling.roll-interval=2minutes
Defensive patterns
Strategy: validation
Validate before calling
private static final Set<String> UNITS = Set.of("m", "min", "minute", "minutes",
"h", "hr", "hour", "hours", "d", "day", "days");
Matcher m = Pattern.compile("^\\s*(\\d+)\\s*([A-Za-z]*)\\s*$").matcher(rollInterval);
if (m.matches() && !m.group(2).isEmpty() && !UNITS.contains(m.group(2).toLowerCase())) {
throw new IllegalArgumentException("Unsupported roll-interval unit: " + m.group(2));
} Try / catch
try {
sink.init(subsetConf);
} catch (MetricsException e) {
// 'Unrecognized unit for flush interval: <unit>' — only minute/hour/day (any case/abbrev/plural) allowed
LOG.error("Fix roll-interval unit '{}' — allowed: m/min/minute, h/hr/hour, d/day (plural ok)",
badUnit, e);
} Prevention
- Use canonical units (minutes/hours/days) in shared config templates
- Remember seconds and weeks are not supported and sub-minute intervals are rejected downstream
- Double-check values translated from other tools' rolling policies — their unit vocabularies differ
When it happens
Trigger: roll-interval=30s, 45sec, 1week, 1w, 2fortnights — any suffix letters outside the m/h/d families, including valid units from other systems.
Common situations: Translating durations from Log4j/Logback rolling policies (which accept week) or Prometheus-style '30s'; assuming seconds are supported; trailing stray letters from a paste.
Related errors
- Failed to create ${basePath}[source=${source}, allow-append=
- Unrecognized flush interval: ${rollInterval}. Must be a numb
- The flush interval property must be at least 1 minute. Value
- The ${key} property must be non-negative. Value was ${value}
- The supplied filesystem base path URI is not a valid URI: ${
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/585e6fccae5a65d0.
Report an issue: GitHub.