{"action":"created","issue":{"url":"https://api.github.com/repos/apache/metron/issues/780","repository_url":"https://api.github.com/repos/apache/metron","labels_url":"https://api.github.com/repos/apache/metron/issues/780/labels{/name}","comments_url":"https://api.github.com/repos/apache/metron/issues/780/comments","events_url":"https://api.github.com/repos/apache/metron/issues/780/events","html_url":"https://github.com/apache/metron/pull/780","id":261672342,"number":780,"title":"METRON-1220: Create documentation around alert nested field","user":{"login":"justinleet","id":5077341,"avatar_url":"https://avatars2.githubusercontent.com/u/5077341?v=4","gravatar_id":"","url":"https://api.github.com/users/justinleet","html_url":"https://github.com/justinleet","followers_url":"https://api.github.com/users/justinleet/followers","following_url":"https://api.github.com/users/justinleet/following{/other_user}","gists_url":"https://api.github.com/users/justinleet/gists{/gist_id}","starred_url":"https://api.github.com/users/justinleet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinleet/subscriptions","organizations_url":"https://api.github.com/users/justinleet/orgs","repos_url":"https://api.github.com/users/justinleet/repos","events_url":"https://api.github.com/users/justinleet/events{/privacy}","received_events_url":"https://api.github.com/users/justinleet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-09-29T15:05:52Z","updated_at":"2017-10-04T16:23:30Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apache/metron/pulls/780","html_url":"https://github.com/apache/metron/pull/780","diff_url":"https://github.com/apache/metron/pull/780.diff","patch_url":"https://github.com/apache/metron/pull/780.patch"},"body":"## Contributor Comments\r\nAdding some docs around the requirement of an \"alert\" field on new sensors.\r\n\r\nThere's an open discussion thread [[DISCUSS] Meta alert Elasticsearch new template requirement ramifications](https://lists.apache.org/thread.html/418ec07c67670f685cc42acfedde85cbd90c80301ea7819093e787f8@%3Cdev.metron.apache.org%3E) that has at least one question about what this should look like, so feel free to chime in there.\r\n\r\nOutstanding Question\r\n* Where should this live?  I have this put up, so people can see what it says, but I'm pretty sure it should live somewhere else, under a different heading.  I'm just not sure what the best fit is.\r\n* Should additional documentation around our ES templates and other sensors requirements be added now or in the future.\r\n\r\nI'll be running the proposed curl up in full dev, so that's slightly subject to change.  Normally, updates to temples don't affect existing ES indices, but since it's a dummy field without data I cautiously expect it to function.\r\n\r\n## Pull Request Checklist\r\n\r\nThank you for submitting a contribution to Apache Metron.  \r\nPlease refer to our [Development Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235) for the complete guide to follow for contributions.  \r\nPlease refer also to our [Build Verification Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview) for complete smoke testing guides.  \r\n\r\n\r\nIn order to streamline the review of the contribution we ask you follow these guidelines and ask you to double check the following:\r\n\r\n### For all changes:\r\n- [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). \r\n- [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.\r\n- [x] Has your PR been rebased against the latest commit within the target branch (typically master)?\r\n\r\n\r\n### For code changes:\r\n- [x] Have you included steps to reproduce the behavior or problem that is being changed or addressed?\r\n- [ ] Have you included steps or a guide to how the change may be verified and tested manually?\r\n- [x] Have you ensured that the full suite of tests and checks have been executed in the root metron folder via:\r\n  ```\r\n  mvn -q clean integration-test install && build_utils/verify_licenses.sh \r\n  ```\r\n\r\n- [x] Have you written or updated unit tests and or integration tests to verify your changes?\r\n- [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)? \r\n- [ ] Have you verified the basic functionality of the build by building and running locally with Vagrant full-dev environment or the equivalent?\r\n\r\n### For documentation related changes:\r\n- [x] 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`:\r\n\r\n  ```\r\n  cd site-book\r\n  mvn site\r\n  ```\r\n\r\n#### Note:\r\nPlease 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.\r\nIt 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.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/metron/issues/comments/334211377","html_url":"https://github.com/apache/metron/pull/780#issuecomment-334211377","issue_url":"https://api.github.com/repos/apache/metron/issues/780","id":334211377,"user":{"login":"justinleet","id":5077341,"avatar_url":"https://avatars2.githubusercontent.com/u/5077341?v=4","gravatar_id":"","url":"https://api.github.com/users/justinleet","html_url":"https://github.com/justinleet","followers_url":"https://api.github.com/users/justinleet/followers","following_url":"https://api.github.com/users/justinleet/following{/other_user}","gists_url":"https://api.github.com/users/justinleet/gists{/gist_id}","starred_url":"https://api.github.com/users/justinleet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinleet/subscriptions","organizations_url":"https://api.github.com/users/justinleet/orgs","repos_url":"https://api.github.com/users/justinleet/repos","events_url":"https://api.github.com/users/justinleet/events{/privacy}","received_events_url":"https://api.github.com/users/justinleet/received_events","type":"User","site_admin":false},"created_at":"2017-10-04T16:23:30Z","updated_at":"2017-10-04T16:23:30Z","author_association":"CONTRIBUTOR","body":"@cestella @nickwallen Hopefully took care of comments that don't involve migrating wiki docs.  Let me know if I looked over anything.  Sidenote, does anybody know how to actually link to a head in a different doc?  Anything inside the same doc works fine, but across docs would be better.\r\n\r\n## Test Plan\r\n\r\n### Setup\r\nRather than creating a new parser, let's just break the Bro one.\r\n1. Spin up full dev\r\n1. Stop bro in monit.\r\n1. Pull down the bro template and delete the extra JSON tag we don't need\r\n    ```\r\n    curl -XGET \"http://node1:9200/_template/bro_index*?pretty\" -o \"bro.template\"\r\n    sed -i '' '2d;$d' ./bro.template\r\n    ```\r\n1. Open it in an editor and remove the `alert` field under `properties`\r\n1. Push the template back.\r\n    ```\r\n    curl -XPUT \"http://node1:9200/_template/bro_index\" -d @${SENSOR}.template\r\n    ```\r\n1. Ensure the `alert` field does **NOT** show up in the template:\r\n    ```\r\n    curl -XGET 'node1:9200/_template/bro_index*?pretty' | grep '\"alert\"'\r\n    ```\r\n1. Delete any existing bro indices\r\n    ```\r\n    curl -XDELETE 'localhost:9200/bro*?pretty'\r\n    ```\r\n1. Turn bro back on in Monit.\r\n1. Wait until new data flows through the system into the bro indexes.\r\n1. Make sure that the mapping has no `alert` field (i.e. Did our updated template apply as expected?).  At this point we should have a sensor without the proper template and existing data.\r\n    ```\r\n    curl -XGET 'node1:9200/bro*/_mapping?pretty' | grep '\"alert\"'\r\n    ```\r\n1. Go into the Swagger UI and run the following search.  It should fail with a 500:\r\n    ```\r\n    {\r\n      \"fields\": [\r\n        \"*\"\r\n      ],\r\n      \"from\": 0,\r\n      \"indices\": [\r\n        \"bro\"\r\n      ],\r\n      \"query\": \"*\",\r\n      \"size\": 10\r\n    }\r\n    ```\r\n1. Run through the commands given in the metron-elasticsearch README to update both the template and the mappings.\r\n1. Ensure the `alert` field shows up in the mappings:\r\n    ```\r\n    curl -XGET 'node1:9200/bro*/_mapping?pretty' | grep '\"alert\"'\r\n    ```\r\n1. Ensure the `alert` field shows up in the template:\r\n    ```\r\n    curl -XGET 'node1:9200/_template/bro_index*?pretty' | grep '\"alert\"'\r\n    ```\r\n1. Rerun the query from the Swagger UI.  Results should be returned now with no error."}}
{"actor":{"display_login":"justinleet"}}