Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 85094200BB3 for ; Wed, 19 Oct 2016 05:19:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 83761160AFB; Wed, 19 Oct 2016 03:19:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 7886B160AF7 for ; Wed, 19 Oct 2016 05:19:06 +0200 (CEST) Received: (qmail 13895 invoked by uid 500); 19 Oct 2016 03:19:05 -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 13882 invoked by uid 99); 19 Oct 2016 03:19:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Oct 2016 03:19:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 34311C0CF3 for ; Wed, 19 Oct 2016 03:19:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id pTmFVkqPGaXT for ; Wed, 19 Oct 2016 03:19:03 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 20B895FC27 for ; Wed, 19 Oct 2016 03:19:01 +0000 (UTC) Received: (qmail 13631 invoked by uid 99); 19 Oct 2016 03:19:01 -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; Wed, 19 Oct 2016 03:19:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 25FBAE2EF2; Wed, 19 Oct 2016 03:19:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: qingwzhao@apache.org To: commits@eagle.incubator.apache.org Date: Wed, 19 Oct 2016 03:19:09 -0000 Message-Id: <51b92bcb6ae64b949290ad7c596e5067@git.apache.org> In-Reply-To: <6d3efa645f734184b21f4bdb62298628@git.apache.org> References: <6d3efa645f734184b21f4bdb62298628@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [10/28] incubator-eagle git commit: EAGLE-307 Update "logstash-kafka-conf.md" Update "logstash-kafka-conf.md" archived-at: Wed, 19 Oct 2016 03:19:07 -0000 EAGLE-307 Update "logstash-kafka-conf.md" Update "logstash-kafka-conf.md" Author: @DadanielZ Reviewer: @yonzhang Closes: #234 Project: http://git-wip-us.apache.org/repos/asf/incubator-eagle/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-eagle/commit/4627eb0b Tree: http://git-wip-us.apache.org/repos/asf/incubator-eagle/tree/4627eb0b Diff: http://git-wip-us.apache.org/repos/asf/incubator-eagle/diff/4627eb0b Branch: refs/heads/master Commit: 4627eb0b576dec25c8c97d57410a044dcbd6af05 Parents: 36422ea Author: yonzhang Authored: Thu Jun 16 15:06:36 2016 -0700 Committer: yonzhang Committed: Thu Jun 16 15:06:36 2016 -0700 ---------------------------------------------------------------------- .../src/main/docs/logstash-kafka-conf.md | 19 ++++- .../src/main/resources/maprFSAuditLog-init.sh | 2 +- .../security/hdfs/MAPRFSResourceConstants.java | 24 +++++++ .../hdfs/rest/MAPRFSResourceWebResource.java | 73 ++++++++++++++++++++ 4 files changed, 115 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4627eb0b/eagle-assembly/src/main/docs/logstash-kafka-conf.md ---------------------------------------------------------------------- diff --git a/eagle-assembly/src/main/docs/logstash-kafka-conf.md b/eagle-assembly/src/main/docs/logstash-kafka-conf.md index 9003fb4..342302b 100644 --- a/eagle-assembly/src/main/docs/logstash-kafka-conf.md +++ b/eagle-assembly/src/main/docs/logstash-kafka-conf.md @@ -120,7 +120,7 @@ The 2.0 release of Logstash includes a new version of the Kafka output plugin wi type => "hdp-nn-audit" path => "/path/to/audit.log" start_position => end - sincedb_path => "/var/log/logstash/" + sincedb_path => "/opt/logstash/sincedb.txt" } } @@ -163,7 +163,7 @@ The 2.0 release of Logstash includes a new version of the Kafka output plugin wi type => "hdp-nn-audit" path => "/path/to/audit.log" start_position => end - sincedb_path => "/var/log/logstash/" + sincedb_path => "/opt/logstash/sincedb.txt" } } @@ -196,6 +196,21 @@ The 2.0 release of Logstash includes a new version of the Kafka output plugin wi } } + +Notice: + `path => "/path/to/audit.log"` : + Here `path` can be configured to be a single string or an array. For example: + `path => [ "var/msg/example.out", /var/message/*.out", "/var/log/*.log"]` + `path => "/var/log/hadoop/hdfs/hdfs-audit.log.*"` +As you can see, we can apply regex pattern to match mutiple files. + + +`sincedb_path => "/opt/logstash/sincedb.txt"`: +`sincedb_path` must be a file writable by logstash. This file will be used by Logstash to keep track of the current position in each file. + + + + #### grok pattern testing We have 3 typical patterns for ugi field as follows 2015-02-11 15:00:00,000 INFO FSNamesystem.audit: allowed=true ugi=user1@xyz.com (auth:TOKEN) ip=/10.115.44.55 cmd=open src=/apps/hdmi-technology/b_pulsar_coe/schema/avroschema/Session.avsc dst=null perm=null http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4627eb0b/eagle-security/eagle-security-maprfs-auditlog/src/main/resources/maprFSAuditLog-init.sh ---------------------------------------------------------------------- diff --git a/eagle-security/eagle-security-maprfs-auditlog/src/main/resources/maprFSAuditLog-init.sh b/eagle-security/eagle-security-maprfs-auditlog/src/main/resources/maprFSAuditLog-init.sh index 5f99190..19eed8d 100644 --- a/eagle-security/eagle-security-maprfs-auditlog/src/main/resources/maprFSAuditLog-init.sh +++ b/eagle-security/eagle-security-maprfs-auditlog/src/main/resources/maprFSAuditLog-init.sh @@ -48,7 +48,7 @@ curl -u ${EAGLE_SERVICE_USER}:${EAGLE_SERVICE_PASSWD} -X POST -H 'Content-Type:a "alias":"MapRFSAuditLogMonitor", "groupName":"MapR", "features":["common","metadata", "classification"], - "config":"{\n\t\"view\": {\n\t\t\"prefix\": \"fileSensitivity\",\n\t\t\"service\": \"FileSensitivityService\",\n\t\t\"keys\": [\n\t\t\t\"filedir\",\n\t\t\t\"sensitivityType\"\n\t\t],\n\t\t\"type\": \"folder\",\n\t\t\"api\": \"hdfsResource\"\n\t}\n}" + "config":"{\n\t\"view\": {\n\t\t\"prefix\": \"fileSensitivity\",\n\t\t\"service\": \"FileSensitivityService\",\n\t\t\"keys\": [\n\t\t\t\"filedir\",\n\t\t\t\"sensitivityType\"\n\t\t],\n\t\t\"type\": \"folder\",\n\t\t\"api\": \"maprfsResource\"\n\t}\n}" } ] ' http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4627eb0b/eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/MAPRFSResourceConstants.java ---------------------------------------------------------------------- diff --git a/eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/MAPRFSResourceConstants.java b/eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/MAPRFSResourceConstants.java new file mode 100644 index 0000000..726ea8b --- /dev/null +++ b/eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/MAPRFSResourceConstants.java @@ -0,0 +1,24 @@ +/* + * 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.service.security.hdfs; + +public class MAPRFSResourceConstants { + + public static final String MAPRFS_RESOURCE="/maprfsResource"; + public static final String MAPRFS_APPLICATION="MAPRFSAuditLog"; + public static final String MAPRFS_RESOURCE_RESOLVE_FORMAT_HINT ="MAPRFS Resource must be start with /"; +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-eagle/blob/4627eb0b/eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/rest/MAPRFSResourceWebResource.java ---------------------------------------------------------------------- diff --git a/eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/rest/MAPRFSResourceWebResource.java b/eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/rest/MAPRFSResourceWebResource.java new file mode 100644 index 0000000..11206bb --- /dev/null +++ b/eagle-security/eagle-security-maprfs-web/src/main/java/org/apache/eagle/service/security/hdfs/rest/MAPRFSResourceWebResource.java @@ -0,0 +1,73 @@ +/* + * 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.service.security.hdfs.rest; + + +import com.typesafe.config.Config; +import org.apache.eagle.security.entity.FileStatusEntity; +import org.apache.eagle.security.resolver.MetadataAccessConfigRepo; +import org.apache.eagle.service.common.EagleExceptionWrapper; +import org.apache.eagle.service.security.hdfs.HDFSFileSystem; +import org.apache.eagle.service.security.hdfs.HDFSResourceSensitivityDataJoiner; +import org.apache.eagle.service.security.hdfs.MAPRFSResourceConstants; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileStatus; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.ws.rs.*; +import javax.ws.rs.core.MediaType; +import java.util.ArrayList; +import java.util.List; + +/** + * REST Web Service to browse files and Paths in MAPRFS + */ +@Path(MAPRFSResourceConstants.MAPRFS_RESOURCE) +public class MAPRFSResourceWebResource +{ + private static Logger LOG = LoggerFactory.getLogger(MAPRFSResourceWebResource.class); + + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public HDFSResourceWebResponse getHDFSResource(@QueryParam("site") String site , @QueryParam("path") String filePath ) + { + LOG.info("Starting MAPRFS Resource Browsing. Query Parameters ==> Site :"+site+" Path : "+filePath ); + HDFSResourceWebResponse response = new HDFSResourceWebResponse(); + HDFSResourceWebRequestValidator validator = new HDFSResourceWebRequestValidator(); + MetadataAccessConfigRepo repo = new MetadataAccessConfigRepo(); + List result = new ArrayList<>(); + List fileStatuses = null; + try { + validator.validate(site, filePath); // First Step would be validating Request + Config config = repo.getConfig(MAPRFSResourceConstants.MAPRFS_APPLICATION, site); + Configuration conf = repo.convert(config); + HDFSFileSystem fileSystem = new HDFSFileSystem(conf); + fileStatuses = fileSystem.browse(filePath); + // Join with File Sensitivity Info + HDFSResourceSensitivityDataJoiner joiner = new HDFSResourceSensitivityDataJoiner(); + result = joiner.joinFileSensitivity(site, fileStatuses); + LOG.info("Successfully browsed files in MAPRFS ."); + } catch( Exception ex ) { + response.setException(EagleExceptionWrapper.wrap(ex)); + LOG.error(" Exception When browsing Files for the MAPRFS Path :"+filePath+" " , ex); + } + response.setObj(result); + return response; + } +}