You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@metron.apache.org by merrimanr <gi...@git.apache.org> on 2018/10/08 19:35:56 UTC

[GitHub] metron pull request #1231: METRON-1811: Alert Search Fails When Sorting by A...

GitHub user merrimanr opened a pull request:

    https://github.com/apache/metron/pull/1231

    METRON-1811: Alert Search Fails When Sorting by Alert Status

    ## Contributor Comments
    This PR fixes sorting on the `alert_status` field in the Alerts UI by defining the field in ES templates as a `keyword` type.  The change was applied to the sensor templates that ship with Metron:  bro, snort and yaf.  This field was added to the Solr schemas as well.
    
    I also updated our documentation to give users guidance when defining their own templates or upgrading their templates.  I expanded this to include other internal fields like `source:type` and `metron_alert`.  I did not include dynamic fields but I can add documentation for that here if it makes sense.
    
    ### Testing
    
    This has been tested in full dev:
    
    1. Spin up full dev and navigate to the Alerts UI.
    2. Change the status of a couple alerts by opening up their details panel and clicking a different status (OPEN for example).
    3. Sort by `alert_status`.  The Alerts UI should properly display alerts by `alert_status` and no errors should be reported in the console.
    4. Enable Solr and verify data is visible in the Alerts UI.  Repeat steps 2 and 3.
    
    ## 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-XXXX where XXXX 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?
    - [x] 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 integration-test install && dev-utilities/build-utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] 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)?
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/merrimanr/incubator-metron METRON-1811

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/1231.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 #1231
    
----
commit 7a707bfbb1c6339f5891763c82e611eb080c4af7
Author: merrimanr <me...@...>
Date:   2018-10-08T14:40:37Z

    initial commit

----


---

[GitHub] metron issue #1231: METRON-1811: Alert Search Fails When Sorting by Alert St...

Posted by merrimanr <gi...@git.apache.org>.
Github user merrimanr commented on the issue:

    https://github.com/apache/metron/pull/1231
  
    I don't know that a test would have caught this.  The issue is that a UI feature was implemented and added a new field to sensor indices in ES.  This new field was not added to the ES templates but the feature still worked because ES has a very flexible schema.  It was a separate, unrelated operation (sorting on the new field) that exposed a problem.
    
    What do you think?  Is there a way we can catch this kind of thing?  I can add a test that simulates a sort but it would only guard against a field being removed from a template and not added.


---

[GitHub] metron issue #1231: METRON-1811: Alert Search Fails When Sorting by Alert St...

Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:

    https://github.com/apache/metron/pull/1231
  
    > I can add a test that simulates a sort but it would only guard against a field being removed from a template and not added.
    
    I agree, let's add that despite the tests limitations as you mentioned.
    
    I ran this up and everything worked great.  Once we knock out that test, I think this is ready to go.


---

[GitHub] metron pull request #1231: METRON-1811: Alert Search Fails When Sorting by A...

Posted by merrimanr <gi...@git.apache.org>.
GitHub user merrimanr reopened a pull request:

    https://github.com/apache/metron/pull/1231

    METRON-1811: Alert Search Fails When Sorting by Alert Status

    ## Contributor Comments
    This PR fixes sorting on the `alert_status` field in the Alerts UI by defining the field in ES templates as a `keyword` type.  The change was applied to the sensor templates that ship with Metron:  bro, snort and yaf.  This field was added to the Solr schemas as well.
    
    I also updated our documentation to give users guidance when defining their own templates or upgrading their templates.  I expanded this to include other internal fields like `source:type` and `metron_alert`.  I did not include dynamic fields but I can add documentation for that here if it makes sense.
    
    ### Testing
    
    This has been tested in full dev:
    
    1. Spin up full dev and navigate to the Alerts UI.
    2. Change the status of a couple alerts by opening up their details panel and clicking a different status (OPEN for example).
    3. Sort by `alert_status`.  The Alerts UI should properly display alerts by `alert_status` and no errors should be reported in the console.
    4. Enable Solr and verify data is visible in the Alerts UI.  Repeat steps 2 and 3.
    
    ## 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-XXXX where XXXX 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?
    - [x] 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 integration-test install && dev-utilities/build-utils/verify_licenses.sh 
      ```
    
    - [x] Have you written or updated unit tests and or integration tests to verify your changes?
    - [x] 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)?
    - [x] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?
    
    ### For documentation related changes:
    - [ ] Have you ensured that format looks appropriate for the output in which it is rendered by building and verifying the site-book? If not then run the following commands and the verify changes via `site-book/target/site/index.html`:
    
      ```
      cd site-book
      mvn site
      ```
    
    #### Note:
    Please ensure that once the PR is submitted, you check travis-ci for build issues and submit an update to your PR as soon as possible.
    It is also recommended that [travis-ci](https://travis-ci.org) is set up for your personal repository such that your branches are built there before submitting a pull request.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/merrimanr/incubator-metron METRON-1811

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/metron/pull/1231.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 #1231
    
----
commit 7a707bfbb1c6339f5891763c82e611eb080c4af7
Author: merrimanr <me...@...>
Date:   2018-10-08T14:40:37Z

    initial commit

commit 7016c1fb1b0cede0191edd32ac1dddf9b191eb13
Author: merrimanr <me...@...>
Date:   2018-10-08T19:36:38Z

    typo

commit 0920cdd0b83ccae7ceb7fc5b0ebfc5284a777e5d
Author: merrimanr <me...@...>
Date:   2018-10-08T19:57:54Z

    fixed test

----


---

[GitHub] metron pull request #1231: METRON-1811: Alert Search Fails When Sorting by A...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/metron/pull/1231


---

[GitHub] metron pull request #1231: METRON-1811: Alert Search Fails When Sorting by A...

Posted by merrimanr <gi...@git.apache.org>.
Github user merrimanr closed the pull request at:

    https://github.com/apache/metron/pull/1231


---

[GitHub] metron issue #1231: METRON-1811: Alert Search Fails When Sorting by Alert St...

Posted by merrimanr <gi...@git.apache.org>.
Github user merrimanr commented on the issue:

    https://github.com/apache/metron/pull/1231
  
    The latest commit changes the SearchIntegrationTest to use the ES templates that ship with Metron.  There are a couple different tests that verify certain fields are defined with the correct types and I made sure the internal fields (including `alert_status`) are covered.  The one potentially confusing change is that a couple test fields are added to the OOTB ES templates before these tests are run.  This was necessary for the existing tests to continue working without major changes.  
    
    I think this should cover it.  Let me know what you think.


---

[GitHub] metron issue #1231: METRON-1811: Alert Search Fails When Sorting by Alert St...

Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:

    https://github.com/apache/metron/pull/1231
  
    +1 Looks great.  I think the test change is well worth it.  Thanks for doing that.


---

[GitHub] metron issue #1231: METRON-1811: Alert Search Fails When Sorting by Alert St...

Posted by nickwallen <gi...@git.apache.org>.
Github user nickwallen commented on the issue:

    https://github.com/apache/metron/pull/1231
  
    @merrimanr Are there any automated tests that could have caught this bug?  Is it possible to add a test for this? 


---