[ 
https://issues.apache.org/jira/browse/HADOOP-18258?focusedWorklogId=783261&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-783261
 ]

ASF GitHub Bot logged work on HADOOP-18258:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 21/Jun/22 08:43
            Start Date: 21/Jun/22 08:43
    Worklog Time Spent: 10m 
      Work Description: sravanigadey commented on code in PR #4383:
URL: https://github.com/apache/hadoop/pull/4383#discussion_r902335968


##########
hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/audit/S3AAuditLogMerger.java:
##########
@@ -0,0 +1,77 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.hadoop.fs.s3a.audit;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Merger class will merge all the audit logs present in a directory of
+ * multiple audit log files into a single audit log file.
+ */
+public class S3AAuditLogMerger {
+
+  private final Logger logger =
+      LoggerFactory.getLogger(S3AAuditLogMerger.class);
+
+  public void mergeFiles(String auditLogsDirectoryPath) throws IOException {
+    File auditLogFilesDirectory = new File(auditLogsDirectoryPath);
+    String[] auditLogFileNames = auditLogFilesDirectory.list();
+
+    //Read each audit log file present in directory and writes each and every 
audit log in it
+    //into a single audit log file
+    if (auditLogFileNames != null && auditLogFileNames.length != 0) {
+      File auditLogFile = new File("AuditLogFile");

Review Comment:
   If the file already exists, the data will overwrite into that existing file.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 783261)
    Time Spent: 4h 50m  (was: 4h 40m)

> Merging of S3A Audit Logs
> -------------------------
>
>                 Key: HADOOP-18258
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18258
>             Project: Hadoop Common
>          Issue Type: Sub-task
>          Components: fs/s3
>            Reporter: Sravani Gadey
>            Assignee: Sravani Gadey
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 4h 50m
>  Remaining Estimate: 0h
>
> Merging audit log files containing huge number of audit logs collected from a 
> job like Hive or Spark job containing various S3 requests like list, head, 
> get and put requests.



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to