AuditCommandParserpublic class AuditLogDirectParser extends java.lang.Object implements AuditCommandParser
AuditCommandParser is used to read commands from an audit log in
the original format audit logs are produced in with a standard configuration.
It requires setting the "auditreplay.log-start-time.ms" configuration to
specify what the start time of the audit log was to determine when events
occurred relative to this start time.
By default, this assumes that the audit log is in the default log format set up by Hadoop, like:
1970-01-01 00:00:00,000 INFO FSNamesystem.audit: allowed=true ...
You can adjust this parsing behavior using the various configurations
available.| Modifier and Type | Field | Description |
|---|---|---|
static java.lang.String |
AUDIT_LOG_DATE_FORMAT_DEFAULT |
|
static java.lang.String |
AUDIT_LOG_DATE_FORMAT_KEY |
The format string used to parse the date which is present in the audit
log.
|
static java.lang.String |
AUDIT_LOG_DATE_TIME_ZONE_DEFAULT |
|
static java.lang.String |
AUDIT_LOG_DATE_TIME_ZONE_KEY |
The time zone to use when parsing the audit log timestamp.
|
static java.lang.String |
AUDIT_LOG_PARSE_REGEX_DEFAULT |
|
static java.lang.String |
AUDIT_LOG_PARSE_REGEX_KEY |
The regex to use when parsing the audit log lines.
|
static java.lang.String |
AUDIT_START_TIMESTAMP_KEY |
See class Javadoc for more detail.
|
| Constructor | Description |
|---|---|
AuditLogDirectParser() |
| Modifier and Type | Method | Description |
|---|---|---|
void |
initialize(org.apache.hadoop.conf.Configuration conf) |
Initialize this parser with the given configuration.
|
org.apache.hadoop.tools.dynamometer.workloadgenerator.audit.AuditReplayCommand |
parse(org.apache.hadoop.io.Text inputLine,
java.util.function.Function<java.lang.Long,java.lang.Long> relativeToAbsolute) |
Convert a line of input into an
AuditReplayCommand. |
public static final java.lang.String AUDIT_START_TIMESTAMP_KEY
public static final java.lang.String AUDIT_LOG_DATE_FORMAT_KEY
SimpleDateFormat.public static final java.lang.String AUDIT_LOG_DATE_FORMAT_DEFAULT
public static final java.lang.String AUDIT_LOG_DATE_TIME_ZONE_KEY
TimeZone.getTimeZone(String).public static final java.lang.String AUDIT_LOG_DATE_TIME_ZONE_DEFAULT
public static final java.lang.String AUDIT_LOG_PARSE_REGEX_KEY
date formatter. The other must be titled "message"
and return the audit content, such as "allowed=true ugi=user ...". See
AUDIT_LOG_PARSE_REGEX_DEFAULT for an example.public static final java.lang.String AUDIT_LOG_PARSE_REGEX_DEFAULT
public void initialize(org.apache.hadoop.conf.Configuration conf)
throws java.io.IOException
AuditCommandParserAuditCommandParser.parse(Text, Function).initialize in interface AuditCommandParserconf - The Configuration to be used to set up this parser.java.io.IOException - if error on initializing a parser.public org.apache.hadoop.tools.dynamometer.workloadgenerator.audit.AuditReplayCommand parse(org.apache.hadoop.io.Text inputLine,
java.util.function.Function<java.lang.Long,java.lang.Long> relativeToAbsolute)
throws java.io.IOException
AuditCommandParserAuditReplayCommand. Since
AuditReplayCommands store absolute timestamps, relativeToAbsolute
can be used to convert relative timestamps (i.e., milliseconds elapsed
between the start of the audit log and this command) into absolute
timestamps.parse in interface AuditCommandParserinputLine - Single input line to convert.relativeToAbsolute - Function converting relative timestamps
(in milliseconds) to absolute timestamps
(in milliseconds).java.io.IOException - if error on parsing.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.