Substitution variables
Substitution variables allow dynamic configuration of paths and filenames based on runtime values.
Available variables
| Variable | Description | Example Output |
|---|---|---|
%app-type% |
Service/application type (hive, hbase, knox, etc.) | hive |
%hostname% |
Hostname of the machine | node1.company.com |
%time:pattern% |
Current timestamp formatted with pattern | See below |
Time pattern formats
Time patterns use Java's SimpleDateFormat syntax:
| Pattern | Description | Example |
|---|---|---|
%time:yyyyMMdd% |
Date (year, month, day) | 20260214 |
%time:yyyy-MM-dd% |
Date with separators | 2026-02-14 |
%time:yyyyMMddHHmmss% |
Full timestamp | 20260214153045 |
%time:yyyy/MM/dd% |
Date with slashes | 2026/02/14 |
%time:yyyy% |
Year only | 2026 |
%time:MM% |
Month only (01-12) | 02 |
%time:dd% |
Day only (01-31) | 14 |
%time:HH% |
Hour (00-23) | 15 |
%time:mm% |
Minute (00-59) | 30 |
%time:ss% |
Second (00-59) | 45 |
%time:yyyyMMdd-HHmmss% |
Date and time | 20260214-153045 |
Usage in configuration
# Directory organization
xasecure.audit.destination.hdfs.dir=hdfs://namenode:8020/ranger/audit
xasecure.audit.destination.hdfs.subdir=%app-type%/%time:yyyy%/%time:MM%/%time:dd%
# Filename with timestamp
xasecure.audit.destination.hdfs.filename.format=%app-type%_audit_%hostname%_%time:yyyyMMddHHmmss%.log
# Result example for Hive on node1.company.com at 2026-02-14 15:30:45:
# Path: hdfs://namenode:8020/ranger/audit/hive/2026/02/14/hive_audit_node1.company.com_20260214153045.log
Substitution timing
-
Directory/Subdirectory: Variables are evaluated when the directory is created (typically at service startup or first write).
-
Filename: Variables are evaluated when the file is created.
-
Rollover: New filename variables are re-evaluated at each rollover time.
