[jira] [Commented] (METRON-1240) address javadoc warnings in metron-platform and metron-analytics
[ https://issues.apache.org/jira/browse/METRON-1240?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16198037#comment-16198037 ] ASF GitHub Bot commented on METRON-1240: GitHub user dbist opened a pull request: https://github.com/apache/metron/pull/794 METRON-1240 address javadoc warnings in metron-platform and metron-analytics ## Contributor Comments [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java:259: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java:79: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java:92: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java:106: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SpoutConfiguration.java:113: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SpoutConfiguration.java:130: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-statistics/src/main/java/org/apache/metron/statistics/OnlineStatisticsProvider.java:191: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-statistics/src/main/java/org/apache/metron/statistics/OnlineStatisticsProvider.java:208: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-statistics/src/main/java/org/apache/metron/statistics/OnlineStatisticsProvider.java:224: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-statistics/src/main/java/org/apache/metron/statistics/StatisticsProvider.java:53: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-writer/src/main/java/org/apache/metron/writer/bolt/BulkMessageWriterBolt.java:105: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-writer/src/main/java/org/apache/metron/writer/bolt/BulkMessageWriterBolt.java:135: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-hbase/src/main/java/org/apache/metron/hbase/bolt/mapper/HBaseProjectionCriteria.java:70: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-hbase/src/main/java/org/apache/metron/hbase/bolt/mapper/HBaseProjectionCriteria.java:80: warning - @return tag has no arguments. ## Pull Request Checklist Thank you for submitting a contribution to Apache Metron. Please refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions. Please refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides. In order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following: ### For all changes: - [x] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). - [x] Does your PR title start with METRON- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [x] Has your PR been rebased against the latest commit within the target branch (typically master)? ### For code changes: - [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed? - [ ] Have you included steps or a guide to how the change may be verified and tested manually? - [x] Have you ensured that the full suite of tests and checks have been executed in the root metron folder via: ``` mvn -q clean
[jira] [Created] (METRON-1240) address javadoc warnings in metron-platform and metron-analytics
Artem Ervits created METRON-1240: Summary: address javadoc warnings in metron-platform and metron-analytics Key: METRON-1240 URL: https://issues.apache.org/jira/browse/METRON-1240 Project: Metron Issue Type: Bug Affects Versions: 0.4.1 Environment: mvn: 3.5.0 jdk: 1.8.0_144 Reporter: Artem Ervits Assignee: Artem Ervits Priority: Minor at build time, getting warnings below {noformat} [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java:259: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java:79: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java:92: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SimpleStormKafkaBuilder.java:106: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SpoutConfiguration.java:113: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-storm-kafka/src/main/java/org/apache/metron/storm/kafka/flux/SpoutConfiguration.java:130: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-statistics/src/main/java/org/apache/metron/statistics/OnlineStatisticsProvider.java:191: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-statistics/src/main/java/org/apache/metron/statistics/OnlineStatisticsProvider.java:208: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-statistics/src/main/java/org/apache/metron/statistics/OnlineStatisticsProvider.java:224: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-statistics/src/main/java/org/apache/metron/statistics/StatisticsProvider.java:53: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-writer/src/main/java/org/apache/metron/writer/bolt/BulkMessageWriterBolt.java:105: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-writer/src/main/java/org/apache/metron/writer/bolt/BulkMessageWriterBolt.java:135: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-hbase/src/main/java/org/apache/metron/hbase/bolt/mapper/HBaseProjectionCriteria.java:70: warning - @return tag has no arguments. [WARNING] /Users/aervits/NetBeansProjects/METRON/metron/metron-platform/metron-hbase/src/main/java/org/apache/metron/hbase/bolt/mapper/HBaseProjectionCriteria.java:80: warning - @return tag has no arguments. {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197746#comment-16197746 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143585182 --- Diff: metron-interface/metron-rest/src/main/java/org/apache/metron/rest/util/ParserIndex.java --- @@ -0,0 +1,92 @@ +/** + * 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.metron.rest.util; + +import org.apache.metron.parsers.interfaces.MessageParser; +import org.reflections.Reflections; +import org.reflections.util.ClasspathHelper; +import org.reflections.util.ConfigurationBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.invoke.MethodHandles; +import java.net.URL; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; + +/** + * Index the parsers. Analyzing the classpath is a costly operation, so caching it makes sense. + * Eventually, we will probably want to have a timer that periodically reindexes so that new parsers show up. + */ +public enum ParserIndex { + INSTANCE; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + private static Setindex; + private static Map availableParsers ; + + static { +load(); + } + + public synchronized Map getIndex() { +if(availableParsers == null) { + load(); +} +return availableParsers; + } + + public synchronized Set getClasses() { +if(index == null) { + load(); +} +return index; + } + + public static void reload() { +load(); + } + + /** + * To handle the situation where classpath is specified in the manifest of the jar, we have to augment the URLs. + * This happens as part of the surefire plugin as well as elsewhere in the wild. + * @param classLoaders + * @return --- End diff -- I figure it's worth mentioning now that we have community contributions correcting warnings and the like, this is going to throw WARNINGs when running javadoc - https://github.com/apache/metron/pull/792 > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1237) address javadoc warnings in metron-maas-common
[ https://issues.apache.org/jira/browse/METRON-1237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197743#comment-16197743 ] ASF GitHub Bot commented on METRON-1237: Github user mmiklavc commented on the issue: https://github.com/apache/metron/pull/792 +1 > address javadoc warnings in metron-maas-common > -- > > Key: METRON-1237 > URL: https://issues.apache.org/jira/browse/METRON-1237 > Project: Metron > Issue Type: Bug >Affects Versions: 0.4.1 > Environment: mvn: 3.5.0 > jdk: 1.8.0_144 >Reporter: Artem Ervits >Assignee: Artem Ervits >Priority: Minor > > address the following warnings in metron-maas-common > {noformat} > [WARNING] Javadoc Warnings > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/Endpoint.java:57: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:41: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:55: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:36: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:48: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:60: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:72: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:84: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:96: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:121: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:224: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:286: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:295: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:334: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/queue/QueueHandler.java:47: > warning - @return tag has no arguments. > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197567#comment-16197567 ] ASF GitHub Bot commented on METRON-1230: Github user cestella commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143555806 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/MergeAndShadeTransformer.java --- @@ -0,0 +1,90 @@ +/** + * 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.metron.parsers.topology; + +import com.google.common.base.Splitter; +import org.apache.storm.daemon.JarTransformer; +import org.apache.storm.hack.StormShadeTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +/** + * This is a storm jar transformer that will add in additional jars pulled from an + * environment variable. The jars will be merged with the main uber jar and then + * the resulting jar will be shaded and relocated according to the StormShadeTransformer. + * + */ +public class MergeAndShadeTransformer implements JarTransformer { + public static final String EXTRA_JARS_ENV = "EXTRA_JARS"; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + StormShadeTransformer _underlyingTransformer = new StormShadeTransformer(); + @Override + public void transform(InputStream input, OutputStream output) throws IOException { +String extraJars = System.getenv().get(EXTRA_JARS_ENV); +if(extraJars == null || extraJars.length() == 0) { + _underlyingTransformer.transform(input, output); + return; +} +File tmpFile = File.createTempFile("metron", "jar"); +tmpFile.deleteOnExit(); +Set entries = new HashSet<>(); +try (JarOutputStream jout = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tmpFile { + try (JarInputStream jin = new JarInputStream(new BufferedInputStream(input))){ +copy(jin, jout, entries); + } + for (String fileStr : Splitter.on(",").split(extraJars)) { +File f = new File(fileStr); +if (!f.exists()) { + continue; +} +LOG.info("Merging jar {} from {}", f.getName(), f.getAbsolutePath()); +try (JarInputStream jin = new JarInputStream(new BufferedInputStream(new FileInputStream(f { + copy(jin, jout, entries); +} + } +} +_underlyingTransformer.transform(new BufferedInputStream(new FileInputStream(tmpFile)), output); + } + + private void copy(JarInputStream jin, JarOutputStream jout, Set entries) throws IOException { +byte[] buffer = new byte[1024]; +for(JarEntry entry = jin.getNextJarEntry(); entry != null; entry = jin.getNextJarEntry()) { + if(entries.contains(entry.getName())) { +continue; + } + if(LOG.isDebugEnabled()) { --- End diff -- Yup > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service >
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197566#comment-16197566 ] ASF GitHub Bot commented on METRON-1230: Github user cestella commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143555784 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/MergeAndShadeTransformer.java --- @@ -0,0 +1,90 @@ +/** + * 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.metron.parsers.topology; + +import com.google.common.base.Splitter; +import org.apache.storm.daemon.JarTransformer; +import org.apache.storm.hack.StormShadeTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +/** + * This is a storm jar transformer that will add in additional jars pulled from an + * environment variable. The jars will be merged with the main uber jar and then + * the resulting jar will be shaded and relocated according to the StormShadeTransformer. + * + */ +public class MergeAndShadeTransformer implements JarTransformer { + public static final String EXTRA_JARS_ENV = "EXTRA_JARS"; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + StormShadeTransformer _underlyingTransformer = new StormShadeTransformer(); + @Override + public void transform(InputStream input, OutputStream output) throws IOException { +String extraJars = System.getenv().get(EXTRA_JARS_ENV); +if(extraJars == null || extraJars.length() == 0) { + _underlyingTransformer.transform(input, output); + return; +} +File tmpFile = File.createTempFile("metron", "jar"); +tmpFile.deleteOnExit(); +Set entries = new HashSet<>(); +try (JarOutputStream jout = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tmpFile { + try (JarInputStream jin = new JarInputStream(new BufferedInputStream(input))){ +copy(jin, jout, entries); + } + for (String fileStr : Splitter.on(",").split(extraJars)) { +File f = new File(fileStr); +if (!f.exists()) { + continue; +} +LOG.info("Merging jar {} from {}", f.getName(), f.getAbsolutePath()); +try (JarInputStream jin = new JarInputStream(new BufferedInputStream(new FileInputStream(f { + copy(jin, jout, entries); --- End diff -- Gotcha > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197565#comment-16197565 ] ASF GitHub Bot commented on METRON-1230: Github user cestella commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143555770 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/MergeAndShadeTransformer.java --- @@ -0,0 +1,90 @@ +/** + * 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.metron.parsers.topology; + +import com.google.common.base.Splitter; +import org.apache.storm.daemon.JarTransformer; +import org.apache.storm.hack.StormShadeTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +/** + * This is a storm jar transformer that will add in additional jars pulled from an + * environment variable. The jars will be merged with the main uber jar and then + * the resulting jar will be shaded and relocated according to the StormShadeTransformer. + * + */ +public class MergeAndShadeTransformer implements JarTransformer { + public static final String EXTRA_JARS_ENV = "EXTRA_JARS"; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + StormShadeTransformer _underlyingTransformer = new StormShadeTransformer(); + @Override + public void transform(InputStream input, OutputStream output) throws IOException { +String extraJars = System.getenv().get(EXTRA_JARS_ENV); +if(extraJars == null || extraJars.length() == 0) { + _underlyingTransformer.transform(input, output); + return; +} +File tmpFile = File.createTempFile("metron", "jar"); +tmpFile.deleteOnExit(); +Set entries = new HashSet<>(); +try (JarOutputStream jout = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tmpFile { + try (JarInputStream jin = new JarInputStream(new BufferedInputStream(input))){ +copy(jin, jout, entries); --- End diff -- Gotcha > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1237) address javadoc warnings in metron-maas-common
[ https://issues.apache.org/jira/browse/METRON-1237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197559#comment-16197559 ] ASF GitHub Bot commented on METRON-1237: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/792#discussion_r143555348 --- Diff: metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/queue/QueueHandler.java --- @@ -42,7 +42,7 @@ /** * Create a queue handler of the specific type * @param config - * @return + * @return queueCreator --- End diff -- This would be a queue, not a creator. > address javadoc warnings in metron-maas-common > -- > > Key: METRON-1237 > URL: https://issues.apache.org/jira/browse/METRON-1237 > Project: Metron > Issue Type: Bug >Affects Versions: 0.4.1 > Environment: mvn: 3.5.0 > jdk: 1.8.0_144 >Reporter: Artem Ervits >Assignee: Artem Ervits >Priority: Minor > > address the following warnings in metron-maas-common > {noformat} > [WARNING] Javadoc Warnings > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/Endpoint.java:57: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:41: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:55: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:36: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:48: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:60: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:72: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:84: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:96: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:121: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:224: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:286: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:295: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:334: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/queue/QueueHandler.java:47: > warning - @return tag has no arguments. > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1237) address javadoc warnings in metron-maas-common
[ https://issues.apache.org/jira/browse/METRON-1237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197561#comment-16197561 ] ASF GitHub Bot commented on METRON-1237: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/792#discussion_r143555210 --- Diff: metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java --- @@ -329,7 +324,7 @@ public ModelEndpoint getEndpoint(Model model) { * List all endpoints for a given model. * * @param model - * @return + * @return ret --- End diff -- Can you make this more descriptive? e.g. Mapping of models to a respective list of endpoints. > address javadoc warnings in metron-maas-common > -- > > Key: METRON-1237 > URL: https://issues.apache.org/jira/browse/METRON-1237 > Project: Metron > Issue Type: Bug >Affects Versions: 0.4.1 > Environment: mvn: 3.5.0 > jdk: 1.8.0_144 >Reporter: Artem Ervits >Assignee: Artem Ervits >Priority: Minor > > address the following warnings in metron-maas-common > {noformat} > [WARNING] Javadoc Warnings > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/Endpoint.java:57: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:41: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:55: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:36: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:48: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:60: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:72: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:84: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:96: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:121: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:224: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:286: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:295: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:334: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/queue/QueueHandler.java:47: > warning - @return tag has no arguments. > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1237) address javadoc warnings in metron-maas-common
[ https://issues.apache.org/jira/browse/METRON-1237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197560#comment-16197560 ] ASF GitHub Bot commented on METRON-1237: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/792#discussion_r14321 --- Diff: metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java --- @@ -50,7 +50,7 @@ public void setServiceRoot(String serviceRoot) { /** * Get the distributed queue implementation handler. By default, we use a queue in zookeeper * as implemented by Apache Curator. - * @return + * @return queue --- End diff -- queue handler > address javadoc warnings in metron-maas-common > -- > > Key: METRON-1237 > URL: https://issues.apache.org/jira/browse/METRON-1237 > Project: Metron > Issue Type: Bug >Affects Versions: 0.4.1 > Environment: mvn: 3.5.0 > jdk: 1.8.0_144 >Reporter: Artem Ervits >Assignee: Artem Ervits >Priority: Minor > > address the following warnings in metron-maas-common > {noformat} > [WARNING] Javadoc Warnings > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/Endpoint.java:57: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:41: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:55: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:36: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:48: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:60: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:72: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:84: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:96: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:121: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:224: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:286: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:295: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:334: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/queue/QueueHandler.java:47: > warning - @return tag has no arguments. > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197553#comment-16197553 ] ASF GitHub Bot commented on METRON-1230: Github user cestella commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143555004 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/ParserTopologyCLI.java --- @@ -285,7 +285,14 @@ public static Options getOptions() { } private static CommandLine parse(Options options, String[] args) { -CommandLineParser parser = new PosixParser(); +CommandLineParser parser = new PosixParser() { + @Override + protected void processOption(String arg, ListIterator iter) throws ParseException { --- End diff -- nvm, if there's a question, then the answer is that we need a comment here. > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1237) address javadoc warnings in metron-maas-common
[ https://issues.apache.org/jira/browse/METRON-1237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197542#comment-16197542 ] ASF GitHub Bot commented on METRON-1237: Github user mmiklavc commented on the issue: https://github.com/apache/metron/pull/792 Ah, you are correct, e.g. ``` [WARNING] /Users/mmiklavcic/devprojects/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/queue/QueueHandler.java:46: warning: no @return [WARNING] public Queue create(Mapconfig) { [WARNING] ^ ``` > address javadoc warnings in metron-maas-common > -- > > Key: METRON-1237 > URL: https://issues.apache.org/jira/browse/METRON-1237 > Project: Metron > Issue Type: Bug >Affects Versions: 0.4.1 > Environment: mvn: 3.5.0 > jdk: 1.8.0_144 >Reporter: Artem Ervits >Assignee: Artem Ervits >Priority: Minor > > address the following warnings in metron-maas-common > {noformat} > [WARNING] Javadoc Warnings > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/Endpoint.java:57: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:41: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:55: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:36: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:48: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:60: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:72: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:84: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:96: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:121: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:224: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:286: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:295: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:334: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/queue/QueueHandler.java:47: > warning - @return tag has no arguments. > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197541#comment-16197541 ] ASF GitHub Bot commented on METRON-1230: Github user cestella commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143553954 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/ParserTopologyCLI.java --- @@ -285,7 +285,14 @@ public static Options getOptions() { } private static CommandLine parse(Options options, String[] args) { -CommandLineParser parser = new PosixParser(); +CommandLineParser parser = new PosixParser() { + @Override + protected void processOption(String arg, ListIterator iter) throws ParseException { --- End diff -- Ah, yes, so this does bear a comment. Not sure if it requires a code comment or not, but the general gist is that in order to pass args to `storm jar` (in this case storm configs to override the transformation class), we have to disregard options that we don't know about in the CLI. Storm will ignore our args, we have to do the same. Do you think that should be a code comment? > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197544#comment-16197544 ] ASF GitHub Bot commented on METRON-1230: Github user cestella commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143554015 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/MergeAndShadeTransformer.java --- @@ -0,0 +1,90 @@ +/** + * 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.metron.parsers.topology; + +import com.google.common.base.Splitter; +import org.apache.storm.daemon.JarTransformer; +import org.apache.storm.hack.StormShadeTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +/** + * This is a storm jar transformer that will add in additional jars pulled from an + * environment variable. The jars will be merged with the main uber jar and then + * the resulting jar will be shaded and relocated according to the StormShadeTransformer. + * + */ +public class MergeAndShadeTransformer implements JarTransformer { + public static final String EXTRA_JARS_ENV = "EXTRA_JARS"; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + StormShadeTransformer _underlyingTransformer = new StormShadeTransformer(); + @Override + public void transform(InputStream input, OutputStream output) throws IOException { --- End diff -- It is. > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197528#comment-16197528 ] ASF GitHub Bot commented on METRON-1230: Github user cestella commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143552937 --- Diff: metron-interface/metron-rest/pom.xml --- @@ -163,6 +163,7 @@ org.apache.metron metron-parsers ${project.parent.version} +provided --- End diff -- Yep, there's no reason to do that, the REST API can load dependencies from the classpath. > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197522#comment-16197522 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143549913 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/MergeAndShadeTransformer.java --- @@ -0,0 +1,90 @@ +/** + * 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.metron.parsers.topology; + +import com.google.common.base.Splitter; +import org.apache.storm.daemon.JarTransformer; +import org.apache.storm.hack.StormShadeTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +/** + * This is a storm jar transformer that will add in additional jars pulled from an + * environment variable. The jars will be merged with the main uber jar and then + * the resulting jar will be shaded and relocated according to the StormShadeTransformer. + * + */ +public class MergeAndShadeTransformer implements JarTransformer { + public static final String EXTRA_JARS_ENV = "EXTRA_JARS"; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + StormShadeTransformer _underlyingTransformer = new StormShadeTransformer(); + @Override + public void transform(InputStream input, OutputStream output) throws IOException { +String extraJars = System.getenv().get(EXTRA_JARS_ENV); +if(extraJars == null || extraJars.length() == 0) { + _underlyingTransformer.transform(input, output); + return; +} +File tmpFile = File.createTempFile("metron", "jar"); +tmpFile.deleteOnExit(); +Set entries = new HashSet<>(); +try (JarOutputStream jout = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tmpFile { + try (JarInputStream jin = new JarInputStream(new BufferedInputStream(input))){ +copy(jin, jout, entries); --- End diff -- Can you document that this method has side effects on the set "entries", or modify the method to return a modified `Set` to make this more explicit? > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197517#comment-16197517 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143542088 --- Diff: metron-interface/metron-rest/pom.xml --- @@ -163,6 +163,7 @@ org.apache.metron metron-parsers ${project.parent.version} +provided --- End diff -- Just so I'm clear, are these additions of "provided" scope along with the "createDependencyReducedPom=false" flag done to remove the embedding of metron-hbase and metron-parsers within the rest API? > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197520#comment-16197520 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143550601 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/MergeAndShadeTransformer.java --- @@ -0,0 +1,90 @@ +/** + * 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.metron.parsers.topology; + +import com.google.common.base.Splitter; +import org.apache.storm.daemon.JarTransformer; +import org.apache.storm.hack.StormShadeTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +/** + * This is a storm jar transformer that will add in additional jars pulled from an + * environment variable. The jars will be merged with the main uber jar and then + * the resulting jar will be shaded and relocated according to the StormShadeTransformer. + * + */ +public class MergeAndShadeTransformer implements JarTransformer { + public static final String EXTRA_JARS_ENV = "EXTRA_JARS"; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + StormShadeTransformer _underlyingTransformer = new StormShadeTransformer(); + @Override + public void transform(InputStream input, OutputStream output) throws IOException { +String extraJars = System.getenv().get(EXTRA_JARS_ENV); +if(extraJars == null || extraJars.length() == 0) { + _underlyingTransformer.transform(input, output); + return; +} +File tmpFile = File.createTempFile("metron", "jar"); +tmpFile.deleteOnExit(); +Set entries = new HashSet<>(); +try (JarOutputStream jout = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tmpFile { + try (JarInputStream jin = new JarInputStream(new BufferedInputStream(input))){ +copy(jin, jout, entries); + } + for (String fileStr : Splitter.on(",").split(extraJars)) { +File f = new File(fileStr); +if (!f.exists()) { + continue; +} +LOG.info("Merging jar {} from {}", f.getName(), f.getAbsolutePath()); +try (JarInputStream jin = new JarInputStream(new BufferedInputStream(new FileInputStream(f { + copy(jin, jout, entries); +} + } +} +_underlyingTransformer.transform(new BufferedInputStream(new FileInputStream(tmpFile)), output); + } + + private void copy(JarInputStream jin, JarOutputStream jout, Set entries) throws IOException { +byte[] buffer = new byte[1024]; +for(JarEntry entry = jin.getNextJarEntry(); entry != null; entry = jin.getNextJarEntry()) { + if(entries.contains(entry.getName())) { +continue; + } + if(LOG.isDebugEnabled()) { --- End diff -- isDebugEnabled is no longer necessary with SLF4J - the token replacement is disabled under the hood if debugging is not enabled. > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197524#comment-16197524 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143546323 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/ParserTopologyCLI.java --- @@ -285,7 +285,14 @@ public static Options getOptions() { } private static CommandLine parse(Options options, String[] args) { -CommandLineParser parser = new PosixParser(); +CommandLineParser parser = new PosixParser() { + @Override + protected void processOption(String arg, ListIterator iter) throws ParseException { --- End diff -- Is this to ignore options passed that we don't provide support for, and can you make a small comment about it? > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197521#comment-16197521 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143550076 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/MergeAndShadeTransformer.java --- @@ -0,0 +1,90 @@ +/** + * 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.metron.parsers.topology; + +import com.google.common.base.Splitter; +import org.apache.storm.daemon.JarTransformer; +import org.apache.storm.hack.StormShadeTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +/** + * This is a storm jar transformer that will add in additional jars pulled from an + * environment variable. The jars will be merged with the main uber jar and then + * the resulting jar will be shaded and relocated according to the StormShadeTransformer. + * + */ +public class MergeAndShadeTransformer implements JarTransformer { + public static final String EXTRA_JARS_ENV = "EXTRA_JARS"; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + StormShadeTransformer _underlyingTransformer = new StormShadeTransformer(); + @Override + public void transform(InputStream input, OutputStream output) throws IOException { +String extraJars = System.getenv().get(EXTRA_JARS_ENV); +if(extraJars == null || extraJars.length() == 0) { + _underlyingTransformer.transform(input, output); + return; +} +File tmpFile = File.createTempFile("metron", "jar"); +tmpFile.deleteOnExit(); +Set entries = new HashSet<>(); +try (JarOutputStream jout = new JarOutputStream(new BufferedOutputStream(new FileOutputStream(tmpFile { + try (JarInputStream jin = new JarInputStream(new BufferedInputStream(input))){ +copy(jin, jout, entries); + } + for (String fileStr : Splitter.on(",").split(extraJars)) { +File f = new File(fileStr); +if (!f.exists()) { + continue; +} +LOG.info("Merging jar {} from {}", f.getName(), f.getAbsolutePath()); +try (JarInputStream jin = new JarInputStream(new BufferedInputStream(new FileInputStream(f { + copy(jin, jout, entries); --- End diff -- Same comment as above re copy/entries > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197526#comment-16197526 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143547079 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/MergeAndShadeTransformer.java --- @@ -0,0 +1,90 @@ +/** + * 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.metron.parsers.topology; + +import com.google.common.base.Splitter; +import org.apache.storm.daemon.JarTransformer; +import org.apache.storm.hack.StormShadeTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +/** + * This is a storm jar transformer that will add in additional jars pulled from an + * environment variable. The jars will be merged with the main uber jar and then + * the resulting jar will be shaded and relocated according to the StormShadeTransformer. + * + */ +public class MergeAndShadeTransformer implements JarTransformer { + public static final String EXTRA_JARS_ENV = "EXTRA_JARS"; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + StormShadeTransformer _underlyingTransformer = new StormShadeTransformer(); --- End diff -- Small nit, but is there a specific reason we're adding an underscore and default visibility for this member variable? > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197518#comment-16197518 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143549304 --- Diff: metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/topology/MergeAndShadeTransformer.java --- @@ -0,0 +1,90 @@ +/** + * 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.metron.parsers.topology; + +import com.google.common.base.Splitter; +import org.apache.storm.daemon.JarTransformer; +import org.apache.storm.hack.StormShadeTransformer; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.*; +import java.lang.invoke.MethodHandles; +import java.util.HashSet; +import java.util.Set; +import java.util.jar.JarEntry; +import java.util.jar.JarInputStream; +import java.util.jar.JarOutputStream; + +/** + * This is a storm jar transformer that will add in additional jars pulled from an + * environment variable. The jars will be merged with the main uber jar and then + * the resulting jar will be shaded and relocated according to the StormShadeTransformer. + * + */ +public class MergeAndShadeTransformer implements JarTransformer { + public static final String EXTRA_JARS_ENV = "EXTRA_JARS"; + private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); + + StormShadeTransformer _underlyingTransformer = new StormShadeTransformer(); + @Override + public void transform(InputStream input, OutputStream output) throws IOException { --- End diff -- Is input the existing uber jar? > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197519#comment-16197519 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143544318 --- Diff: metron-interface/metron-rest/src/main/java/org/apache/metron/rest/service/impl/SensorParserConfigServiceImpl.java --- @@ -122,29 +123,15 @@ public boolean delete(String name) throws RestException { @Override public MapgetAvailableParsers() { -if (availableParsers == null) { - availableParsers = new HashMap<>(); - Set parserClasses = getParserClasses(); - parserClasses.forEach(parserClass -> { -if (!"BasicParser".equals(parserClass.getSimpleName())) { - availableParsers.put(parserClass.getSimpleName().replaceAll("Basic|Parser", ""), - parserClass.getName()); -} - }); -} -return availableParsers; +return ParserIndex.INSTANCE.getIndex(); --- End diff -- Nice > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1230) As a stopgap prior to METRON-777, add more simplistic sideloading of custom Parsers
[ https://issues.apache.org/jira/browse/METRON-1230?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197525#comment-16197525 ] ASF GitHub Bot commented on METRON-1230: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/785#discussion_r143552344 --- Diff: metron-interface/metron-rest/src/main/scripts/metron-rest.sh --- @@ -47,6 +55,15 @@ rest_jar_pattern="${METRON_HOME}/lib/metron-rest*.jar" rest_files=( ${rest_jar_pattern} ) echo "Default metron-rest jar is: ${rest_files[0]}" METRON_REST_CLASSPATH+=":${rest_files[0]}" +METRON_REST_CLASSPATH+=":$PARSER_LIB" + +if [ -d "$PARSER_CONTRIB" ]; then + contrib_jar_pattern="${PARSER_CONTRIB}/*.jar" + contrib_list=( $contrib_jar_pattern ) # expand the glob to a list --- End diff -- This is probably ok per our supported OS's and shells, but I don't think this is cross platform. It does not work in ZSH, for instance. > As a stopgap prior to METRON-777, add more simplistic sideloading of custom > Parsers > --- > > Key: METRON-1230 > URL: https://issues.apache.org/jira/browse/METRON-1230 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Until we get 777 in, it'd be nice to have a simple ability using the normal > storm functionality to enable users to provide custom parsers without forking > Metron. This should be done via simply creating a jar with their code (and > bundled dependencies) and have it picked up and available to the REST Service > (and consequently the management UI) as well as the start_parser_topology.sh > command. > This should be minimal movement as we have a more robust solution coming with > METRON-777. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1232) Alert status changes are not reflected in list view
[ https://issues.apache.org/jira/browse/METRON-1232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197428#comment-16197428 ] ASF GitHub Bot commented on METRON-1232: Github user mmiklavc commented on a diff in the pull request: https://github.com/apache/metron/pull/787#discussion_r143541485 --- Diff: metron-interface/metron-alerts/e2e/alerts-list/alerts-list.po.ts --- @@ -231,10 +231,12 @@ export class MetronAlertsPage { } clickRemoveSearchChip() { -let aceLine = element.all(by.css('.ace_keyword')).get(0); -browser.actions().mouseMove(aceLine).perform().then(() => { - this.waitForElementPresence(element(by.css('.ace_value i'))).then(() => { -element.all(by.css('.ace_value i')).get(0).click(); +element(by.css('app-alerts-list .ace_text-input')).sendKeys('').then(() => { --- End diff -- I'd like to see a couple things with this. Can you add some code comments along with perhaps splitting this up into more descriptive functions? There's a lot of chaining/lambda/closures going on here. > Alert status changes are not reflected in list view > --- > > Key: METRON-1232 > URL: https://issues.apache.org/jira/browse/METRON-1232 > Project: Metron > Issue Type: Bug >Reporter: RaghuMitra >Assignee: RaghuMitra > > When escalating an alert (changing its status), the list view does not > reflect the change until a refresh occurs. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1232) Alert status changes are not reflected in list view
[ https://issues.apache.org/jira/browse/METRON-1232?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197395#comment-16197395 ] ASF GitHub Bot commented on METRON-1232: Github user nickwallen commented on a diff in the pull request: https://github.com/apache/metron/pull/787#discussion_r143535792 --- Diff: metron-interface/metron-alerts/src/app/shared/directives/alert-search.directive.ts --- @@ -130,7 +130,7 @@ export class AlertSearchDirective implements AfterViewInit, OnChanges { private handleMouseEvent (callback: Function) { clearTimeout(this.mouseEventTimer); -this.mouseEventTimer = setTimeout(() => { callback(); }, 500); +this.mouseEventTimer = setTimeout(() => { callback(); }, 100); --- End diff -- Was this change intentional? > Alert status changes are not reflected in list view > --- > > Key: METRON-1232 > URL: https://issues.apache.org/jira/browse/METRON-1232 > Project: Metron > Issue Type: Bug >Reporter: RaghuMitra >Assignee: RaghuMitra > > When escalating an alert (changing its status), the list view does not > reflect the change until a refresh occurs. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1237) address javadoc warnings in metron-maas-common
[ https://issues.apache.org/jira/browse/METRON-1237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197366#comment-16197366 ] ASF GitHub Bot commented on METRON-1237: Github user dbist commented on the issue: https://github.com/apache/metron/pull/792 @mmiklavc my understanding is that if we leave off @return tag, javadoc will still throw a warning about a missing return tag, please advise, I'm impartial. > address javadoc warnings in metron-maas-common > -- > > Key: METRON-1237 > URL: https://issues.apache.org/jira/browse/METRON-1237 > Project: Metron > Issue Type: Bug >Affects Versions: 0.4.1 > Environment: mvn: 3.5.0 > jdk: 1.8.0_144 >Reporter: Artem Ervits >Assignee: Artem Ervits >Priority: Minor > > address the following warnings in metron-maas-common > {noformat} > [WARNING] Javadoc Warnings > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/Endpoint.java:57: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:41: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:55: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:36: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:48: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:60: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:72: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:84: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:96: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:121: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:224: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:286: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:295: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:334: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/queue/QueueHandler.java:47: > warning - @return tag has no arguments. > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1233) Remove description of Global configuration from Enrichment doc
[ https://issues.apache.org/jira/browse/METRON-1233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197337#comment-16197337 ] ASF GitHub Bot commented on METRON-1233: Github user mmiklavc commented on the issue: https://github.com/apache/metron/pull/789 Thanks for the contribution @DimDroll. Can you take a look at https://github.com/apache/metron/pull/791 - does this help? There are some relevant global config options for enrichment. > Remove description of Global configuration from Enrichment doc > -- > > Key: METRON-1233 > URL: https://issues.apache.org/jira/browse/METRON-1233 > Project: Metron > Issue Type: Improvement >Reporter: Dima Kovalyov >Priority: Minor > > It confuses reader. Description of Global configuration is available ahead of > the enrichment and listed here: > https://metron.apache.org/current-book/metron-platform/metron-common/index.html > Global config is used for validation of the fields. > Enrichment is used for fields enrichment and probably can also be used for > validation of the fields (which is not covered in the doc). > From available doc I can see that they serve two different purposes. > So, I don't see any reason to mention global config in enrichment > description. What's the benefit of knowing about global configuration when > you want deep dive in enrichment? -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1237) address javadoc warnings in metron-maas-common
[ https://issues.apache.org/jira/browse/METRON-1237?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197299#comment-16197299 ] ASF GitHub Bot commented on METRON-1237: Github user mmiklavc commented on the issue: https://github.com/apache/metron/pull/792 Might it be better to leave off the @return altogether where the methods are self-describing? > address javadoc warnings in metron-maas-common > -- > > Key: METRON-1237 > URL: https://issues.apache.org/jira/browse/METRON-1237 > Project: Metron > Issue Type: Bug >Affects Versions: 0.4.1 > Environment: mvn: 3.5.0 > jdk: 1.8.0_144 >Reporter: Artem Ervits >Assignee: Artem Ervits >Priority: Minor > > address the following warnings in metron-maas-common > {noformat} > [WARNING] Javadoc Warnings > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/Endpoint.java:57: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:41: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/MaaSConfig.java:55: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:36: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:48: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:60: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:72: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:84: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/config/ModelRequest.java:96: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:121: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:224: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:286: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:295: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/discovery/ServiceDiscoverer.java:334: > warning - @return tag has no arguments. > [WARNING] > /Users/aervits/NetBeansProjects/METRON/metron/metron-analytics/metron-maas-common/src/main/java/org/apache/metron/maas/queue/QueueHandler.java:47: > warning - @return tag has no arguments. > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1226) Searching Can Errantly Query the Wrong Indices
[ https://issues.apache.org/jira/browse/METRON-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197288#comment-16197288 ] ASF GitHub Bot commented on METRON-1226: Github user mmiklavc commented on the issue: https://github.com/apache/metron/pull/793 This is looking pretty good by inspection. Good minor refactorings and javadoc additions as well. I'd like to run it up in full dev when I get a moment. > Searching Can Errantly Query the Wrong Indices > -- > > Key: METRON-1226 > URL: https://issues.apache.org/jira/browse/METRON-1226 > Project: Metron > Issue Type: Bug >Reporter: Nick Allen >Assignee: Nick Allen > > The ElasticsearchDAO can errantly query the wrong indices under certain > conditions. This can occur when there are at least two different sensors > that have been configured with a similar name prefix. > For example, if you have have configured both a "snort" and "snort_v2" > sensor, the query generated by the ElasticsearchDAO will hit both of those > indices, when in fact only one or the other is desired. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1226) Searching Can Errantly Query the Wrong Indices
[ https://issues.apache.org/jira/browse/METRON-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197042#comment-16197042 ] ASF GitHub Bot commented on METRON-1226: Github user nickwallen commented on a diff in the pull request: https://github.com/apache/metron/pull/793#discussion_r143481097 --- Diff: metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/utils/ElasticsearchUtils.java --- @@ -45,15 +49,30 @@ public static SimpleDateFormat getIndexFormat(MapglobalConfig) return DATE_FORMAT_CACHE.get().computeIfAbsent(format, SimpleDateFormat::new); } + /** + * Builds the name of an Elasticsearch index. + * @param sensorType The sensor type; bro, yaf, snort, ... + * @param indexPostfix The index postfix; most often a formatted date. + * @param configurations User-defined configuration for the writers. + */ public static String getIndexName(String sensorType, String indexPostfix, WriterConfiguration configurations) { String indexName = sensorType; if (configurations != null) { indexName = configurations.getIndex(sensorType); } -indexName = indexName + "_index_" + indexPostfix; +indexName = indexName + getIndexDelimiter() + "_" + indexPostfix; return indexName; } + /** + * Returns the delimiter that is appended to the user-defined index name to separate + * the index's date postfix. For example, if the user-defined index name is 'bro' + * and the delimiter is '_index_', then one likely index name is 'bro_index_2017.10.03.19'. + */ + public static String getIndexDelimiter() { --- End diff -- Honestly, I have no idea. I went down a dangerous rabbit hole making tons of changes, then backed myself out to just what is in this PR. It might have been for changes that I backed out. Making it a `static final String` certainly would be more expected. I'll fix it. > Searching Can Errantly Query the Wrong Indices > -- > > Key: METRON-1226 > URL: https://issues.apache.org/jira/browse/METRON-1226 > Project: Metron > Issue Type: Bug >Reporter: Nick Allen >Assignee: Nick Allen > > The ElasticsearchDAO can errantly query the wrong indices under certain > conditions. This can occur when there are at least two different sensors > that have been configured with a similar name prefix. > For example, if you have have configured both a "snort" and "snort_v2" > sensor, the query generated by the ElasticsearchDAO will hit both of those > indices, when in fact only one or the other is desired. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1238) Enrichment topology start at EARLIEST again after de-activating topology
[ https://issues.apache.org/jira/browse/METRON-1238?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197007#comment-16197007 ] Simon Elliston Ball commented on METRON-1238: - While this is potentially an issue in Kafka / Storm, I suspect the likely cause is that you need to, for some reason reset kafka offsets when processing has lagged to far. Instead of reverting to EARLIEST, you can use my very hacky tool https://github.com/simonellistonball/kafka-utils to manipulate offsets for the relevant consumer group. Note this will be superseded by a much cleaner version in Kafka 0.11. See https://cwiki.apache.org/confluence/display/KAFKA/KIP-122%3A+Add+Reset+Consumer+Group+Offsets+tooling and https://issues.apache.org/jira/browse/KAFKA-4743 for details on the proper way. > Enrichment topology start at EARLIEST again after de-activating topology > > > Key: METRON-1238 > URL: https://issues.apache.org/jira/browse/METRON-1238 > Project: Metron > Issue Type: Bug >Affects Versions: 0.4.1 > Environment: 0.4.1.3.0.0 >Reporter: Jasper Knulst > > When the enrichment topology is started with the firstPollStrategy EARLIEST > and then de-activate the topology from the Storm UI, the kafkaspout begins > consuming again from EARLIEST when the topology is activated again. > To reproduce: > -Start enrichment with firstPollOffsetStrategy set to EARLIEST > -De-activate topology (Storm UI) after a while (check topology offset) > -Wait > -Activate topology again > -Check topology offset > I think the Kafkaspouts are reinstantiated when you do this and the spout > config is hanging somewhere in its original state -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1226) Searching Can Errantly Query the Wrong Indices
[ https://issues.apache.org/jira/browse/METRON-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197005#comment-16197005 ] ASF GitHub Bot commented on METRON-1226: Github user cestella commented on a diff in the pull request: https://github.com/apache/metron/pull/793#discussion_r143473906 --- Diff: metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/utils/ElasticsearchUtils.java --- @@ -45,15 +49,30 @@ public static SimpleDateFormat getIndexFormat(MapglobalConfig) return DATE_FORMAT_CACHE.get().computeIfAbsent(format, SimpleDateFormat::new); } + /** + * Builds the name of an Elasticsearch index. + * @param sensorType The sensor type; bro, yaf, snort, ... + * @param indexPostfix The index postfix; most often a formatted date. + * @param configurations User-defined configuration for the writers. + */ public static String getIndexName(String sensorType, String indexPostfix, WriterConfiguration configurations) { String indexName = sensorType; if (configurations != null) { indexName = configurations.getIndex(sensorType); } -indexName = indexName + "_index_" + indexPostfix; +indexName = indexName + getIndexDelimiter() + "_" + indexPostfix; return indexName; } + /** + * Returns the delimiter that is appended to the user-defined index name to separate + * the index's date postfix. For example, if the user-defined index name is 'bro' + * and the delimiter is '_index_', then one likely index name is 'bro_index_2017.10.03.19'. + */ + public static String getIndexDelimiter() { --- End diff -- I'm more curious than opposed to this, but is there a strong reason why this isn't just a `public static final String`? > Searching Can Errantly Query the Wrong Indices > -- > > Key: METRON-1226 > URL: https://issues.apache.org/jira/browse/METRON-1226 > Project: Metron > Issue Type: Bug >Reporter: Nick Allen >Assignee: Nick Allen > > The ElasticsearchDAO can errantly query the wrong indices under certain > conditions. This can occur when there are at least two different sensors > that have been configured with a similar name prefix. > For example, if you have have configured both a "snort" and "snort_v2" > sensor, the query generated by the ElasticsearchDAO will hit both of those > indices, when in fact only one or the other is desired. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1226) Searching Can Errantly Query the Wrong Indices
[ https://issues.apache.org/jira/browse/METRON-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16197004#comment-16197004 ] ASF GitHub Bot commented on METRON-1226: Github user cestella commented on a diff in the pull request: https://github.com/apache/metron/pull/793#discussion_r143473489 --- Diff: metron-platform/metron-elasticsearch/src/main/java/org/apache/metron/elasticsearch/dao/ElasticsearchDao.java --- @@ -154,9 +134,9 @@ protected SearchResponse search(SearchRequest searchRequest, QueryBuilder queryB .size(searchRequest.getSize()) .from(searchRequest.getFrom()) .query(queryBuilder) - .trackScores(true); -searchRequest.getSort().forEach(sortField -> searchSourceBuilder.sort(sortField.getField(), getElasticsearchSortOrder(sortField.getSortOrder(;Optionalfields = searchRequest.getFields(); +searchRequest.getSort().forEach(sortField -> searchSourceBuilder.sort(sortField.getField(), getElasticsearchSortOrder(sortField.getSortOrder(; --- End diff -- haha, thanks for cleaning this up. :) > Searching Can Errantly Query the Wrong Indices > -- > > Key: METRON-1226 > URL: https://issues.apache.org/jira/browse/METRON-1226 > Project: Metron > Issue Type: Bug >Reporter: Nick Allen >Assignee: Nick Allen > > The ElasticsearchDAO can errantly query the wrong indices under certain > conditions. This can occur when there are at least two different sensors > that have been configured with a similar name prefix. > For example, if you have have configured both a "snort" and "snort_v2" > sensor, the query generated by the ElasticsearchDAO will hit both of those > indices, when in fact only one or the other is desired. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1226) Searching Can Errantly Query the Wrong Indices
[ https://issues.apache.org/jira/browse/METRON-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16196987#comment-16196987 ] ASF GitHub Bot commented on METRON-1226: Github user nickwallen commented on the issue: https://github.com/apache/metron/pull/793 @cestella Not that I am aware of. I launched Full Dev and was able to submit queries and use the Alerts UI as before. I will add that to the "Test" section for completeness. > Searching Can Errantly Query the Wrong Indices > -- > > Key: METRON-1226 > URL: https://issues.apache.org/jira/browse/METRON-1226 > Project: Metron > Issue Type: Bug >Reporter: Nick Allen >Assignee: Nick Allen > > The ElasticsearchDAO can errantly query the wrong indices under certain > conditions. This can occur when there are at least two different sensors > that have been configured with a similar name prefix. > For example, if you have have configured both a "snort" and "snort_v2" > sensor, the query generated by the ElasticsearchDAO will hit both of those > indices, when in fact only one or the other is desired. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1226) Searching Can Errantly Query the Wrong Indices
[ https://issues.apache.org/jira/browse/METRON-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16196977#comment-16196977 ] ASF GitHub Bot commented on METRON-1226: Github user cestella commented on the issue: https://github.com/apache/metron/pull/793 Does this cause any issues in the alerts UI? > Searching Can Errantly Query the Wrong Indices > -- > > Key: METRON-1226 > URL: https://issues.apache.org/jira/browse/METRON-1226 > Project: Metron > Issue Type: Bug >Reporter: Nick Allen >Assignee: Nick Allen > > The ElasticsearchDAO can errantly query the wrong indices under certain > conditions. This can occur when there are at least two different sensors > that have been configured with a similar name prefix. > For example, if you have have configured both a "snort" and "snort_v2" > sensor, the query generated by the ElasticsearchDAO will hit both of those > indices, when in fact only one or the other is desired. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1235) Document the properties pulled from the global configuration
[ https://issues.apache.org/jira/browse/METRON-1235?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16196967#comment-16196967 ] ASF GitHub Bot commented on METRON-1235: Github user asfgit closed the pull request at: https://github.com/apache/metron/pull/791 > Document the properties pulled from the global configuration > > > Key: METRON-1235 > URL: https://issues.apache.org/jira/browse/METRON-1235 > Project: Metron > Issue Type: Improvement >Reporter: Casey Stella > > Our global config is very flexible and multiple parts of the system pull > configuration from it. Also, Ambari manages bits and pieces of that > configuration. It's imperative to make precise which properties are managed > in the global config, what they're for and whether ambari manages them. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1223) Add support to add comments for alerts
[ https://issues.apache.org/jira/browse/METRON-1223?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16196969#comment-16196969 ] ASF GitHub Bot commented on METRON-1223: Github user simonellistonball commented on a diff in the pull request: https://github.com/apache/metron/pull/788#discussion_r143470175 --- Diff: metron-interface/metron-alerts/src/app/alerts/alert-details/alert-details.component.ts --- @@ -133,6 +173,40 @@ export class AlertDetailsComponent implements OnInit { }); } + onAddComment() { +let alertComment = new AlertComment(this.alertCommentStr, this.authenticationService.getCurrentUserName(), new Date().getTime()); +let tAlertComments = this.alertCommentsWrapper.map(alertsWrapper => alertsWrapper.alertComment); +tAlertComments.unshift(alertComment); +this.patchAlert(new Patch('add', '/comments', tAlertComments)); + } + + patchAlert(patch: Patch) { +let patchRequest = new PatchRequest(); +patchRequest.guid = this.alertSource.guid; +patchRequest.index = this.alertIndex; +patchRequest.patch = [patch]; +patchRequest.sensorType = this.alertSourceType; + +this.updateService.patch(patchRequest).subscribe(() => { + this.getData(); +}); + } + + onDeleteComment(index: number) { +let commentText = 'Do you wish to delete the comment '; +if (this.alertCommentsWrapper[index].alertComment.comment.length > 25 ) { + commentText += ' \'' + this.alertCommentsWrapper[index].alertComment.comment.substr(0, 25) + '...\''; +} else { + commentText += ' \'' + this.alertCommentsWrapper[index].alertComment.comment + '\''; +} + + this.metronDialogBox.showConfirmationMessage(commentText).subscribe(response => { + if (response) { +this.alertCommentsWrapper.splice(index, 1); +this.patchAlert(new Patch('add', '/comments', this.alertCommentsWrapper.map(alertsWrapper => alertsWrapper.alertComment))); --- End diff -- @justinleet makes sense, the goal is to get something in fast and iterate, but it sounds like getting the field nested is not going to be much more work than the alerts work we already have to do, so can piggyback on that and minimise the upgrade effort. There is I believe some separate work going on making reindexing easier, which may help here (though we should also ensure that that work is DAO aware when reindexing commented stuff from HDFS) > Add support to add comments for alerts > -- > > Key: METRON-1223 > URL: https://issues.apache.org/jira/browse/METRON-1223 > Project: Metron > Issue Type: New Feature >Reporter: RaghuMitra >Assignee: RaghuMitra > > Add support for adding arbitrary text notes to an alert. This can be achieved > by using METRON-1051. > The comments should contain the username of the user who created the comment > and timestamp when the comment was added. > Users should be able to remove a comment too. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (METRON-1226) Searching Can Errantly Query the Wrong Indices
[ https://issues.apache.org/jira/browse/METRON-1226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16196924#comment-16196924 ] ASF GitHub Bot commented on METRON-1226: GitHub user nickwallen opened a pull request: https://github.com/apache/metron/pull/793 METRON-1226 Searching Can Errantly Query the Wrong Indices The ElasticsearchDAO can errantly query the wrong indices under certain conditions. This can occur when there are at least two different sensors that have been configured with a similar name prefix. For example, consider the case when the user has created two different sensors; "snort" and "snort_v2". When the user attempts to query the "snort" index in Elasticsearch, the query generated by the ElasticsearchDAO will hit both of these indices which is unexpected. ## Pull Request Checklist - [ ] Is there a JIRA ticket associated with this PR? If not one needs to be created at [Metron Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel). - [ ] Does your PR title start with METRON- where is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character. - [ ] Has your PR been rebased against the latest commit within the target branch (typically master)? - [ ] Have you included steps to reproduce the behavior or problem that is being changed or addressed? - [ ] Have you included steps or a guide to how the change may be verified and tested manually? - [ ] Have you ensured that the full suite of tests and checks have been executed in the root metron folder via: - [ ] Have you written or updated unit tests and or integration tests to verify your changes? - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? - [ ] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent? You can merge this pull request into a Git repository by running: $ git pull https://github.com/nickwallen/metron METRON-1226 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/metron/pull/793.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #793 commit 4ab87f55d30b584c7943edfb8bfc5cbca89eabde Author: Nick AllenDate: 2017-10-03T22:10:00Z METRON-1226 Searching Can Errantly Query the Wrong Indices > Searching Can Errantly Query the Wrong Indices > -- > > Key: METRON-1226 > URL: https://issues.apache.org/jira/browse/METRON-1226 > Project: Metron > Issue Type: Bug >Reporter: Nick Allen >Assignee: Nick Allen > > The ElasticsearchDAO can errantly query the wrong indices under certain > conditions. This can occur when there are at least two different sensors > that have been configured with a similar name prefix. > For example, if you have have configured both a "snort" and "snort_v2" > sensor, the query generated by the ElasticsearchDAO will hit both of those > indices, when in fact only one or the other is desired. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (METRON-1239) Drop extra dev environments
[ https://issues.apache.org/jira/browse/METRON-1239?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Justin Leet updated METRON-1239: Description: Per [list discussion|https://lists.apache.org/thread.html/953431c50263817e2bd2e03012dcd1e6af74e38f120eeae198bea720@%3Cdev.metron.apache.org%3E], we want to kill the extra dev environments to make our installation and dev paths more obvious. This consists of: * Kill quick-dev-platform * Kill codelab-platform * Update any source documentation * Update wiki documentation, which may be just clearing things out. It's possible things on the wiki should just live in the site-book, so feel free to move things to source if it's appropriate to do so. * Potentially document differences between these environments and full dev if we think there's anything useful. This is probably optional, since I think it's mainly relevant to codelab's Ansible skiptags which I think it's just entirely pointless. There's probably also some additional things surrounding quick-dev building and setup that we may or may not want to purge as part of this. was: Per [list discussion|https://lists.apache.org/thread.html/953431c50263817e2bd2e03012dcd1e6af74e38f120eeae198bea720@%3Cdev.metron.apache.org%3E], we want to kill the extra dev environments to make our installation and dev paths more obvious. This consists * Kill quick-dev-platform * Kill codelab-platform * Update any source documentation * Update wiki documentation, which may be just clearing things out. It's possible things on the wiki should just live in the site-book, so feel free to move things to source if it's appropriate to do so. * Potentially document differences between these environments and full dev if we think there's anything useful. This is probably optional, since I think it's mainly relevant to codelab's Ansible skiptags which I think it just entirely pointless. > Drop extra dev environments > --- > > Key: METRON-1239 > URL: https://issues.apache.org/jira/browse/METRON-1239 > Project: Metron > Issue Type: Bug >Reporter: Justin Leet > > Per [list > discussion|https://lists.apache.org/thread.html/953431c50263817e2bd2e03012dcd1e6af74e38f120eeae198bea720@%3Cdev.metron.apache.org%3E], > we want to kill the extra dev environments to make our installation and dev > paths more obvious. > This consists of: > * Kill quick-dev-platform > * Kill codelab-platform > * Update any source documentation > * Update wiki documentation, which may be just clearing things out. It's > possible things on the wiki should just live in the site-book, so feel free > to move things to source if it's appropriate to do so. > * Potentially document differences between these environments and full dev if > we think there's anything useful. This is probably optional, since I think > it's mainly relevant to codelab's Ansible skiptags which I think it's just > entirely pointless. > There's probably also some additional things surrounding quick-dev building > and setup that we may or may not want to purge as part of this. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (METRON-1239) Drop extra dev environments
Justin Leet created METRON-1239: --- Summary: Drop extra dev environments Key: METRON-1239 URL: https://issues.apache.org/jira/browse/METRON-1239 Project: Metron Issue Type: Bug Reporter: Justin Leet Per [list discussion|https://lists.apache.org/thread.html/953431c50263817e2bd2e03012dcd1e6af74e38f120eeae198bea720@%3Cdev.metron.apache.org%3E], we want to kill the extra dev environments to make our installation and dev paths more obvious. This consists * Kill quick-dev-platform * Kill codelab-platform * Update any source documentation * Update wiki documentation, which may be just clearing things out. It's possible things on the wiki should just live in the site-book, so feel free to move things to source if it's appropriate to do so. * Potentially document differences between these environments and full dev if we think there's anything useful. This is probably optional, since I think it's mainly relevant to codelab's Ansible skiptags which I think it just entirely pointless. -- This message was sent by Atlassian JIRA (v6.4.14#64029)