Skip to content

Conversation

@adoroszlai
Copy link
Contributor

What changes were proposed in this pull request?

Make all Log4J2 loggers asynchronous (only used for audit logging in Ozone) via the system property log4j2.contextSelector. This prevents lookup of location information by default, and "will give the best performance" by avoiding some intermediate threads.

https://issues.apache.org/jira/browse/HDDS-4442

How was this patch tested?

Updated TestOzoneAuditLogger unit test:

  • include class name in the log message
  • verify that only ? is logged, due to lack of location information

Temporarily made the same change in OM audit log pattern:

diff --git hadoop-ozone/dist/src/shell/conf/om-audit-log4j2.properties hadoop-ozone/dist/src/shell/conf/om-audit-log4j2.properties
index 57577e162..170d6840e 100644
--- hadoop-ozone/dist/src/shell/conf/om-audit-log4j2.properties
+++ hadoop-ozone/dist/src/shell/conf/om-audit-log4j2.properties
@@ -71,7 +71,7 @@ appender.rolling.name=RollingFile
 appender.rolling.fileName =${sys:hadoop.log.dir}/om-audit-${hostName}.log
 appender.rolling.filePattern=${sys:hadoop.log.dir}/om-audit-${hostName}-%d{yyyy-MM-dd-HH-mm-ss}-%i.log.gz
 appender.rolling.layout.type=PatternLayout
-appender.rolling.layout.pattern=%d{DEFAULT} | %-5level | %c{1} | %msg | %throwable{3} %n
+appender.rolling.layout.pattern=%d{DEFAULT} | %-5level | %c{1} | %C | %msg | %throwable{3} %n
 appender.rolling.policies.type=Policies
 appender.rolling.policies.time.type=TimeBasedTriggeringPolicy
 appender.rolling.policies.time.interval=86400

and checked OM audit log:

$ docker-compose exec om bash -c 'cat /var/log/hadoop/*audit*log'
2020-11-10 13:49:53,322 | INFO  | OMAudit | ? | user=hadoop | ip=192.168.96.6 | op=CREATE_VOLUME {admin=hadoop, owner=hadoop, volume=vol1, creationTime=1605016193288, modificationTime=1605016193288, quotaInBytes=-1, quotaInCounts=-1, objectID=256, updateID=1, usedBytes=0} | ret=SUCCESS |
2020-11-10 13:49:53,390 | INFO  | OMAudit | ? | user=hadoop | ip=192.168.96.6 | op=CREATE_BUCKET {volume=vol1, bucket=bucket1, gdprEnabled=null, acls=[user:hadoop:a[ACCESS], group:users:a[ACCESS]], isVersionEnabled=false, storageType=DISK, creationTime=1605016193368, bucketEncryptionKey=null, modificationTime=1605016193368, usedBytes=0} | ret=SUCCESS |
2020-11-10 13:49:53,587 | INFO  | OMAudit | ? | user=hadoop | ip=192.168.96.6 | op=ALLOCATE_KEY {volume=vol1, bucket=bucket1, key=vm7ozunjvq/0, dataSize=10240, replicationType=RATIS, replicationFactor=THREE} | ret=SUCCESS |
2020-11-10 13:49:57,490 | INFO  | OMAudit | ? | user=hadoop | ip=192.168.96.6 | op=COMMIT_KEY {volume=vol1, bucket=bucket1, key=vm7ozunjvq/0, dataSize=10240, replicationType=RATIS, replicationFactor=ONE} | ret=SUCCESS |

@adoroszlai adoroszlai self-assigned this Nov 10, 2020
@jojochuang jojochuang requested a review from elek November 10, 2020 15:02
@jojochuang
Copy link
Contributor

We should update the PR title...

@adoroszlai adoroszlai changed the title HDDS-4442. Disable the location information of audit logger to reduce overhead HDDS-4442. Make all Log4J2 loggers asynchronous Nov 10, 2020
Copy link
Member

@elek elek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, thanks the patch @adoroszlai and the review @jojochuang

@elek elek merged commit d203b64 into apache:master Nov 16, 2020
@adoroszlai adoroszlai deleted the HDDS-4442 branch November 16, 2020 11:36
@adoroszlai
Copy link
Contributor Author

Thanks @jojochuang for reporting and reviewing this, and @elek for reviewing and committing the fix.

errose28 added a commit to errose28/ozone that referenced this pull request Nov 18, 2020
* master: (53 commits)
  HDDS-4458. Fix Max Transaction ID value in OM. (apache#1585)
  HDDS-4442. Disable the location information of audit logger to reduce overhead (apache#1567)
  HDDS-4441. Add metrics for ACL related operations.(Addendum for HA). (apache#1584)
  HDDS-4081. Create ZH translation of StorageContainerManager.md in doc. (apache#1558)
  HDDS-4080. Create ZH translation of OzoneManager.md in doc. (apache#1541)
  HDDS-4079. Create ZH translation of Containers.md in doc. (apache#1539)
  HDDS-4184. Add Features menu for Chinese document. (apache#1547)
  HDDS-4235. Ozone client FS path validation is not present in OFS. (apache#1582)
  HDDS-4338. Fix the issue that SCM web UI banner shows "HDFS SCM". (apache#1583)
  HDDS-4337. Implement RocksDB options cache for new datanode DB utilities. (apache#1544)
  HDDS-4083. Create ZH translation of Recon.md in doc (apache#1575)
  HDDS-4453. Replicate closed container for random selected datanodes. (apache#1574)
  HDDS-4408: terminate Datanode when Datanode State Machine Thread got uncaught exception. (apache#1533)
  HDDS-4443. Recon: Using Mysql database throws exception and fails startup (apache#1570)
  HDDS-4315. Use Epoch to generate unique ObjectIDs (apache#1480)
  HDDS-4455. Fix typo in README.md doc (apache#1578)
  HDDS-4441. Add metrics for ACL related operations. (apache#1571)
  HDDS-4437. Avoid unnecessary builder conversion in setting volume Quota/Owner request (apache#1564)
  HDDS-4417. Simplify Ozone client code with configuration object (apache#1542)
  HDDS-4363. Add metric to track the number of RocksDB open/close operations. (apache#1530)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants