Return-Path: X-Original-To: apmail-eagle-commits-archive@minotaur.apache.org Delivered-To: apmail-eagle-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 03F79186A4 for ; Thu, 19 Nov 2015 11:09:05 +0000 (UTC) Received: (qmail 97501 invoked by uid 500); 19 Nov 2015 11:09:04 -0000 Delivered-To: apmail-eagle-commits-archive@eagle.apache.org Received: (qmail 97477 invoked by uid 500); 19 Nov 2015 11:09:04 -0000 Mailing-List: contact commits-help@eagle.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@eagle.incubator.apache.org Delivered-To: mailing list commits@eagle.incubator.apache.org Received: (qmail 97468 invoked by uid 99); 19 Nov 2015 11:09:04 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2015 11:09:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 7CE9B1A5AAB for ; Thu, 19 Nov 2015 11:09:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.771 X-Spam-Level: * X-Spam-Status: No, score=1.771 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id uP6ukb1vwb2d for ; Thu, 19 Nov 2015 11:08:58 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id E900922F0A for ; Thu, 19 Nov 2015 11:08:57 +0000 (UTC) Received: (qmail 97437 invoked by uid 99); 19 Nov 2015 11:08:57 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 19 Nov 2015 11:08:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id B03FFE0A83; Thu, 19 Nov 2015 11:08:57 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: hao@apache.org To: commits@eagle.incubator.apache.org Message-Id: <94d1cdebd7fc4922ae629127eb2457f5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: incubator-eagle git commit: [EAGLE-46] Fixed org.apache package name Date: Thu, 19 Nov 2015 11:08:57 +0000 (UTC) Repository: incubator-eagle Updated Branches: refs/heads/master bf35ede03 -> 2bae00443 [EAGLE-46] Fixed org.apache package name Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/2bae0044 Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/2bae0044 Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/2bae0044 Branch: refs/heads/master Commit: 2bae0044361437155ec73fa7ce64bec6affbd1db Parents: bf35ede Author: Hao Chen Authored: Thu Nov 19 19:06:53 2015 +0800 Committer: Hao Chen Committed: Thu Nov 19 19:06:53 2015 +0800 ---------------------------------------------------------------------- .../java/eagle/security/util/LogParseUtil.java | 65 -------------------- .../eagle/security/util/LogParseUtil.java | 65 ++++++++++++++++++++ .../parse/HDFSSecurityLogParser.java | 2 +- 3 files changed, 66 insertions(+), 66 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2bae0044/eagle-security/eagle-security-common/src/main/java/eagle/security/util/LogParseUtil.java ---------------------------------------------------------------------- diff --git a/eagle-security/eagle-security-common/src/main/java/eagle/security/util/LogParseUtil.java b/eagle-security/eagle-security-common/src/main/java/eagle/security/util/LogParseUtil.java deleted file mode 100644 index 1d59d12..0000000 --- a/eagle-security/eagle-security-common/src/main/java/eagle/security/util/LogParseUtil.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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 eagle.security.util; - - -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class LogParseUtil { - /** - * .e.g. user@APD.xyz.com - */ - private final static Pattern UGI_PATTERN_DEFAULT = Pattern.compile("^([\\w\\d\\-]+)@.*"); - /** - * .e.g. hadoop/123.dc1.xyz.com@xyz.com (auth:KERBEROS) - */ - private final static Pattern UGI_PATTERN_SYSTEM = Pattern.compile("^([\\w\\d\\-]+)/[\\w\\d\\-.]+@.*"); - - /** - * .e.g. hadoop (auth:KERBEROS) - */ - private final static Pattern UGI_PATTERN_WITHBLANK = Pattern.compile("^([\\w\\d.\\-_]+)[\\s(]+.*"); - - /** - * @param ugi UGI field of audit log - * @return resultToMetrics user from UGI field of audit log - */ - public static String parseUserFromUGI(String ugi) { - if(ugi == null) return null; - String newugi = ugi.trim(); - - Matcher defaultMatcher = UGI_PATTERN_DEFAULT.matcher(newugi); - if(defaultMatcher.matches()){ - return defaultMatcher.group(1); - } - - Matcher sysMatcher = UGI_PATTERN_SYSTEM.matcher(newugi); - if(sysMatcher.matches()){ - return sysMatcher.group(1); - } - - Matcher viaMatcher = UGI_PATTERN_WITHBLANK.matcher(newugi); - if(viaMatcher.matches()){ - return viaMatcher.group(1); - } - - return newugi; - } -} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2bae0044/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/util/LogParseUtil.java ---------------------------------------------------------------------- diff --git a/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/util/LogParseUtil.java b/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/util/LogParseUtil.java new file mode 100644 index 0000000..6d7d2ed --- /dev/null +++ b/eagle-security/eagle-security-common/src/main/java/org/apache/eagle/security/util/LogParseUtil.java @@ -0,0 +1,65 @@ +/* + * 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.eagle.security.util; + + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class LogParseUtil { + /** + * .e.g. user@APD.xyz.com + */ + private final static Pattern UGI_PATTERN_DEFAULT = Pattern.compile("^([\\w\\d\\-]+)@.*"); + /** + * .e.g. hadoop/123.dc1.xyz.com@xyz.com (auth:KERBEROS) + */ + private final static Pattern UGI_PATTERN_SYSTEM = Pattern.compile("^([\\w\\d\\-]+)/[\\w\\d\\-.]+@.*"); + + /** + * .e.g. hadoop (auth:KERBEROS) + */ + private final static Pattern UGI_PATTERN_WITHBLANK = Pattern.compile("^([\\w\\d.\\-_]+)[\\s(]+.*"); + + /** + * @param ugi UGI field of audit log + * @return resultToMetrics user from UGI field of audit log + */ + public static String parseUserFromUGI(String ugi) { + if(ugi == null) return null; + String newugi = ugi.trim(); + + Matcher defaultMatcher = UGI_PATTERN_DEFAULT.matcher(newugi); + if(defaultMatcher.matches()){ + return defaultMatcher.group(1); + } + + Matcher sysMatcher = UGI_PATTERN_SYSTEM.matcher(newugi); + if(sysMatcher.matches()){ + return sysMatcher.group(1); + } + + Matcher viaMatcher = UGI_PATTERN_WITHBLANK.matcher(newugi); + if(viaMatcher.matches()){ + return viaMatcher.group(1); + } + + return newugi; + } +} http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/2bae0044/eagle-security/eagle-security-hdfs-securitylog/src/main/java/eagle/security/securitylog/parse/HDFSSecurityLogParser.java ---------------------------------------------------------------------- diff --git a/eagle-security/eagle-security-hdfs-securitylog/src/main/java/eagle/security/securitylog/parse/HDFSSecurityLogParser.java b/eagle-security/eagle-security-hdfs-securitylog/src/main/java/eagle/security/securitylog/parse/HDFSSecurityLogParser.java index fd2fc28..144fb94 100644 --- a/eagle-security/eagle-security-hdfs-securitylog/src/main/java/eagle/security/securitylog/parse/HDFSSecurityLogParser.java +++ b/eagle-security/eagle-security-hdfs-securitylog/src/main/java/eagle/security/securitylog/parse/HDFSSecurityLogParser.java @@ -19,7 +19,7 @@ package eagle.security.securitylog.parse; -import eagle.security.util.LogParseUtil; +import org.apache.eagle.security.util.LogParseUtil; import org.apache.eagle.common.DateTimeUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory;