[jira] [Comment Edited] (KNOX-1147) KNOX Audit Log time not configurable or not supporting TZ
[ https://issues.apache.org/jira/browse/KNOX-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16290033#comment-16290033 ] Rajesh Chandramohan edited comment on KNOX-1147 at 12/13/17 10:38 PM: -- [~lmccay] Please Review the attached changes , Can work on enhanced version to merge with v15 too. was (Author: rajeshhadoop): Please check the attached changes. > KNOX Audit Log time not configurable or not supporting TZ > - > > Key: KNOX-1147 > URL: https://issues.apache.org/jira/browse/KNOX-1147 > Project: Apache Knox > Issue Type: Improvement >Affects Versions: 0.10.0, 0.13.0, 0.14.0 >Reporter: Rajesh Chandramohan > Fix For: 0.15.0 > > Attachments: KNOX-1147.patch > > > The KNOX Log4J configuration for Knoxaudit log uses > or.hadoop.gateway.audit.log4j.layout.AuditLayout , so when the system is > using PST tz , The auditLog is logging with 1hr ahead of current PST time. Is > there a way to log audit event matching with current time in system and not > break with DST change? > Even in latest version it is having hardcoded time pattern , not able to add > Time zone. Was thinking of adding > setDateFormat(DATE_FORMAT, TimeZone.getTimeZone(TZ)); But is there any other > better way to get around this issue? > + > public class AuditLayout extends DateLayout { > > private static final String DATE_FORMAT = "yy/MM/dd HH:mm:ss"; > private static final String SEPARATOR = "|"; > private StringBuffer sb = new StringBuffer(); > Override > public void activateOptions() { > setDateFormat( DATE_FORMAT ); > } > + > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (KNOX-1147) KNOX Audit Log time not configurable or not supporting TZ
[ https://issues.apache.org/jira/browse/KNOX-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rajesh Chandramohan updated KNOX-1147: -- Status: Patch Available (was: Open) Please check the attached changes. > KNOX Audit Log time not configurable or not supporting TZ > - > > Key: KNOX-1147 > URL: https://issues.apache.org/jira/browse/KNOX-1147 > Project: Apache Knox > Issue Type: Improvement >Affects Versions: 0.10.0, 0.13.0, 0.14.0 >Reporter: Rajesh Chandramohan > Fix For: 0.15.0 > > Attachments: KNOX-1147.patch > > > The KNOX Log4J configuration for Knoxaudit log uses > or.hadoop.gateway.audit.log4j.layout.AuditLayout , so when the system is > using PST tz , The auditLog is logging with 1hr ahead of current PST time. Is > there a way to log audit event matching with current time in system and not > break with DST change? > Even in latest version it is having hardcoded time pattern , not able to add > Time zone. Was thinking of adding > setDateFormat(DATE_FORMAT, TimeZone.getTimeZone(TZ)); But is there any other > better way to get around this issue? > + > public class AuditLayout extends DateLayout { > > private static final String DATE_FORMAT = "yy/MM/dd HH:mm:ss"; > private static final String SEPARATOR = "|"; > private StringBuffer sb = new StringBuffer(); > Override > public void activateOptions() { > setDateFormat( DATE_FORMAT ); > } > + > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (KNOX-1147) KNOX Audit Log time not configurable or not supporting TZ
[ https://issues.apache.org/jira/browse/KNOX-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rajesh Chandramohan updated KNOX-1147: -- Attachment: KNOX-1147.patch Adding a patch, which helps with this case. We can extend further by giving the Configurable variable for layout through log4j.properties as like log4j.EnhancedPatternLayout > KNOX Audit Log time not configurable or not supporting TZ > - > > Key: KNOX-1147 > URL: https://issues.apache.org/jira/browse/KNOX-1147 > Project: Apache Knox > Issue Type: Improvement >Affects Versions: 0.10.0, 0.13.0, 0.14.0 >Reporter: Rajesh Chandramohan > Fix For: 0.15.0 > > Attachments: KNOX-1147.patch > > > The KNOX Log4J configuration for Knoxaudit log uses > or.hadoop.gateway.audit.log4j.layout.AuditLayout , so when the system is > using PST tz , The auditLog is logging with 1hr ahead of current PST time. Is > there a way to log audit event matching with current time in system and not > break with DST change? > Even in latest version it is having hardcoded time pattern , not able to add > Time zone. Was thinking of adding > setDateFormat(DATE_FORMAT, TimeZone.getTimeZone(TZ)); But is there any other > better way to get around this issue? > + > public class AuditLayout extends DateLayout { > > private static final String DATE_FORMAT = "yy/MM/dd HH:mm:ss"; > private static final String SEPARATOR = "|"; > private StringBuffer sb = new StringBuffer(); > Override > public void activateOptions() { > setDateFormat( DATE_FORMAT ); > } > + > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Issue Comment Deleted] (KNOX-1147) KNOX Audit Log time not configurable or not supporting TZ
[ https://issues.apache.org/jira/browse/KNOX-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rajesh Chandramohan updated KNOX-1147: -- Comment: was deleted (was: diff --git a/gateway-util-common/pom.xml b/gateway-util-common/pom.xml index 867b58f..3be0d3a 100644 --- a/gateway-util-common/pom.xml +++ b/gateway-util-common/pom.xml @@ -22,7 +22,7 @@ org.apache.knox gateway -0.10.0 +0.10.1 gateway-util-common diff --git a/gateway-util-common/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java b/gateway-util-common/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java index 09f827c..ee92e0f 100644 --- a/gateway-util-common/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java +++ b/gateway-util-common/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java @@ -25,6 +25,8 @@ import org.apache.hadoop.gateway.audit.log4j.correlation.Log4jCorrelationService import org.apache.log4j.helpers.DateLayout; import org.apache.log4j.spi.LoggingEvent; +import java.util.TimeZone; + /** * Formats audit record to following output: * date time root_request_id|parent_request_id|request_id|channel|target_service|username|proxy_username|system_username|action|resource_type|resource_name|outcome|message @@ -33,11 +35,17 @@ public class AuditLayout extends DateLayout { private static final String DATE_FORMAT = "yy/MM/dd HH:mm:ss"; private static final String SEPARATOR = "|"; + private static final String TZ = "PST"; private StringBuffer sb = new StringBuffer(); - @Override - public void activateOptions() { + /*@Override + public void activateOptions() { setDateFormat( DATE_FORMAT ); + } */ + + @Override + public void activateOptions(){ +setDateFormat(DATE_FORMAT, TimeZone.getTimeZone(TZ)); } @Override diff --git a/pom.xml b/pom.xml index a8e9983..efd0422 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ org.apache.knox gateway -0.10.0 +0.10.1 pom gateway ) > KNOX Audit Log time not configurable or not supporting TZ > - > > Key: KNOX-1147 > URL: https://issues.apache.org/jira/browse/KNOX-1147 > Project: Apache Knox > Issue Type: Improvement >Affects Versions: 0.10.0, 0.13.0, 0.14.0 >Reporter: Rajesh Chandramohan > Fix For: 0.15.0 > > > The KNOX Log4J configuration for Knoxaudit log uses > or.hadoop.gateway.audit.log4j.layout.AuditLayout , so when the system is > using PST tz , The auditLog is logging with 1hr ahead of current PST time. Is > there a way to log audit event matching with current time in system and not > break with DST change? > Even in latest version it is having hardcoded time pattern , not able to add > Time zone. Was thinking of adding > setDateFormat(DATE_FORMAT, TimeZone.getTimeZone(TZ)); But is there any other > better way to get around this issue? > + > public class AuditLayout extends DateLayout { > > private static final String DATE_FORMAT = "yy/MM/dd HH:mm:ss"; > private static final String SEPARATOR = "|"; > private StringBuffer sb = new StringBuffer(); > Override > public void activateOptions() { > setDateFormat( DATE_FORMAT ); > } > + > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (KNOX-1147) KNOX Audit Log time not configurable or not supporting TZ
[ https://issues.apache.org/jira/browse/KNOX-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rajesh Chandramohan updated KNOX-1147: -- Status: Open (was: Patch Available) diff --git a/gateway-util-common/pom.xml b/gateway-util-common/pom.xml index 867b58f..3be0d3a 100644 --- a/gateway-util-common/pom.xml +++ b/gateway-util-common/pom.xml @@ -22,7 +22,7 @@ org.apache.knox gateway -0.10.0 +0.10.1 gateway-util-common diff --git a/gateway-util-common/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java b/gateway-util-common/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java index 09f827c..ee92e0f 100644 --- a/gateway-util-common/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java +++ b/gateway-util-common/src/main/java/org/apache/hadoop/gateway/audit/log4j/layout/AuditLayout.java @@ -25,6 +25,8 @@ import org.apache.hadoop.gateway.audit.log4j.correlation.Log4jCorrelationService import org.apache.log4j.helpers.DateLayout; import org.apache.log4j.spi.LoggingEvent; +import java.util.TimeZone; + /** * Formats audit record to following output: * date time root_request_id|parent_request_id|request_id|channel|target_service|username|proxy_username|system_username|action|resource_type|resource_name|outcome|message @@ -33,11 +35,17 @@ public class AuditLayout extends DateLayout { private static final String DATE_FORMAT = "yy/MM/dd HH:mm:ss"; private static final String SEPARATOR = "|"; + private static final String TZ = "PST"; private StringBuffer sb = new StringBuffer(); - @Override - public void activateOptions() { + /*@Override + public void activateOptions() { setDateFormat( DATE_FORMAT ); + } */ + + @Override + public void activateOptions(){ +setDateFormat(DATE_FORMAT, TimeZone.getTimeZone(TZ)); } @Override diff --git a/pom.xml b/pom.xml index a8e9983..efd0422 100644 --- a/pom.xml +++ b/pom.xml @@ -26,7 +26,7 @@ org.apache.knox gateway -0.10.0 +0.10.1 pom gateway > KNOX Audit Log time not configurable or not supporting TZ > - > > Key: KNOX-1147 > URL: https://issues.apache.org/jira/browse/KNOX-1147 > Project: Apache Knox > Issue Type: Improvement >Affects Versions: 0.10.0, 0.13.0, 0.14.0 >Reporter: Rajesh Chandramohan > Fix For: 0.15.0 > > > The KNOX Log4J configuration for Knoxaudit log uses > or.hadoop.gateway.audit.log4j.layout.AuditLayout , so when the system is > using PST tz , The auditLog is logging with 1hr ahead of current PST time. Is > there a way to log audit event matching with current time in system and not > break with DST change? > Even in latest version it is having hardcoded time pattern , not able to add > Time zone. Was thinking of adding > setDateFormat(DATE_FORMAT, TimeZone.getTimeZone(TZ)); But is there any other > better way to get around this issue? > + > public class AuditLayout extends DateLayout { > > private static final String DATE_FORMAT = "yy/MM/dd HH:mm:ss"; > private static final String SEPARATOR = "|"; > private StringBuffer sb = new StringBuffer(); > Override > public void activateOptions() { > setDateFormat( DATE_FORMAT ); > } > + > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (KNOX-1147) KNOX Audit Log time not configurable or not supporting TZ
[ https://issues.apache.org/jira/browse/KNOX-1147?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Rajesh Chandramohan updated KNOX-1147: -- Status: Patch Available (was: Open) > KNOX Audit Log time not configurable or not supporting TZ > - > > Key: KNOX-1147 > URL: https://issues.apache.org/jira/browse/KNOX-1147 > Project: Apache Knox > Issue Type: Improvement >Affects Versions: 0.10.0, 0.13.0, 0.14.0 >Reporter: Rajesh Chandramohan > Fix For: 0.15.0 > > > The KNOX Log4J configuration for Knoxaudit log uses > or.hadoop.gateway.audit.log4j.layout.AuditLayout , so when the system is > using PST tz , The auditLog is logging with 1hr ahead of current PST time. Is > there a way to log audit event matching with current time in system and not > break with DST change? > Even in latest version it is having hardcoded time pattern , not able to add > Time zone. Was thinking of adding > setDateFormat(DATE_FORMAT, TimeZone.getTimeZone(TZ)); But is there any other > better way to get around this issue? > + > public class AuditLayout extends DateLayout { > > private static final String DATE_FORMAT = "yy/MM/dd HH:mm:ss"; > private static final String SEPARATOR = "|"; > private StringBuffer sb = new StringBuffer(); > Override > public void activateOptions() { > setDateFormat( DATE_FORMAT ); > } > + > Thanks -- This message was sent by Atlassian JIRA (v6.4.14#64029)