[
https://issues.apache.org/jira/browse/METRON-249?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15623292#comment-15623292
]
ASF GitHub Bot commented on METRON-249:
---------------------------------------
Github user cestella commented on a diff in the pull request:
https://github.com/apache/incubator-metron/pull/333#discussion_r85824225
--- Diff:
metron-platform/metron-common/src/main/java/org/apache/metron/common/dsl/functions/NetworkFunctions.java
---
@@ -232,10 +237,15 @@ private static URL toUrl(Object urlObj) {
if(urlObj == null) {
return null;
}
- try {
- return new URL(urlObj.toString());
- } catch (MalformedURLException e) {
- return null;
+ if(urlObj instanceof String) {
+ try {
+ return new URL(urlObj.toString());
+ } catch (MalformedURLException e) {
--- End diff --
I'm treating a distinction here between a type or syntactic error which is
likely a configuration error and should be immediately percolated up versus a
semantic error (the data is malformed, but still of the proper type) which
should be allowed to pass. It's not necessarily an error. You could have a
source which contains a `url` field which is not populated or populated with a
default value, so you'd expect the processed fields to also be null.
> Field Transformation functions fail to handle invalid user inputs
> ------------------------------------------------------------------
>
> Key: METRON-249
> URL: https://issues.apache.org/jira/browse/METRON-249
> Project: Metron
> Issue Type: Bug
> Reporter: Neha Sinha
> Priority: Minor
> Labels: platform
> Fix For: 0.2.1BETA
>
> Attachments: LogException.rtf
>
>
> Hi,
> The field transformation functions fail to handle invalid user input .On
> providing invalid inputs the parser throws exceptions and fails to create the
> required indices in elasticsearch.
> ==========================
> Steps to Reproduce
> ==========================
> Edit the squid.json file and provide the following definition to it:-(Note-we
> are giving an invalid input :-123 to the URL_TO_HOST function)
> -----------------------------------------------------------------------------------------------
> {
> "parserClassName": "org.apache.metron.parsers.GrokParser",
> "sensorTopic": "squid",
> "parserConfig": {
> "grokPath": "/patterns/squid",
> "patternLabel": "SQUID_DELIMITED",
> "timestampField": "timestamp"
> },
> "fieldTransformations" : [
> {
> "transformation" : "MTL"
> ,"output" : [ "full_hostname", "domain_without_subdomains" ]
> ,"config" : {
> "full_hostname" : “URL_TO_HOST(123)"
> ,"domain_without_subdomains" : "DOMAIN_REMOVE_SUBDOMAINS(full_hostname)"
> }
> }
> ]
> }
> ----------------------------------------------------------------------------------------------------
> Replay Squid events/logs and monitor the logs in storm for squid topology.
> Attached exception log would be seen and no indexes would be created
> respective to the logs.
> Expected Behaviour :-
> 1.The error should be more clean.
> 2.Since we cannot validate the inputs the invalid inputs should be ignored
> and the indices should get created anyway based on the Grok parser output
> Regards,
> Neha
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)