[
https://issues.apache.org/jira/browse/METRON-1150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16151192#comment-16151192
]
ASF GitHub Bot commented on METRON-1150:
----------------------------------------
GitHub user merrimanr opened a pull request:
https://github.com/apache/metron/pull/729
METRON-1150: REST parseMessage endpoint fails with Unable to load <grok
file> from either classpath or HDFS
## Contributor Comments
This PR fixes a regression in the REST app related to parsing sample
messages with Grok. When parsing a sample message, the REST app now stores the
temporary grok pattern in HDFS instead of the local file system.
This has been tested on full dev and can be verified in a couple different
ways. The `/api/v1/sensor/parser/config/parseMessage` endpoint should now
correctly parse a sample message with Grok. For example, this request:
```
{
"sampleData": "1461576382.642 161 127.0.0.1 TCP_MISS/200 103701 GET
http://www.cnn.com/ - DIRECT/199.27.79.73 text/html",
"sensorParserConfig": {
"parserClassName": "org.apache.metron.parsers.GrokParser",
"filterClassName": null,
"sensorTopic": "squid",
"writerClassName": null,
"errorWriterClassName": null,
"invalidWriterClassName": null,
"readMetadata": false,
"mergeMetadata": false,
"parserConfig": {
"grokPath": "./squid",
"patternLabel": "SQUID_DELIMITED",
"timestampField": "timestamp"
},
"fieldTransformations": [
{
"input": [],
"output": [
"full_hostname",
"domain_without_subdomains"
],
"transformation": "STELLAR",
"config": {
"full_hostname": "URL_TO_HOST(url)",
"domain_without_subdomains":
"DOMAIN_REMOVE_SUBDOMAINS(full_hostname)"
}
}
]
},
"grokStatement": "SQUID_DELIMITED
%{NUMBER:timestamp}[^0-9]*%{INT:elapsed} %{IP:ip_src_addr}
%{WORD:action}/%{NUMBER:code} %{NUMBER:bytes} %{WORD:method}
%{NOTSPACE:url}[^0-9]*(%{IP:ip_dst_addr})?\n\n"
}
```
Should now properly return a parsed message. This can also be verified
with the management UI by editing a parser of type Grok (squid for example) and
testing sample data in the Grok editor pane.
I also removed the "grok.path.default" property from REST because it was no
longer being used.
## 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 && 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:
- [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`:
```
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-1150
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/metron/pull/729.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 #729
----
commit 1ccf4f372ace43ac5507e261ccf1e654ec374257
Author: merrimanr <[email protected]>
Date: 2017-09-01T21:29:47Z
initial commit
----
> REST parseMessage endpoint fails with Unable to load <grok file> from either
> classpath or HDFS
> ----------------------------------------------------------------------------------------------
>
> Key: METRON-1150
> URL: https://issues.apache.org/jira/browse/METRON-1150
> Project: Metron
> Issue Type: Bug
> Reporter: Ryan Merriman
> Assignee: Ryan Merriman
>
> There was a regression introduced with
> https://github.com/apache/metron/pull/672. Previously the REST application
> would store grok patterns locally when parsing a sample message with the
> GrokParser. Now that REST gets it's HDFS configuration from core-site.xml,
> the GrokParser will always look in HDFS. As a result, the REST app should
> store temporary grok files in HDFS instead.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)