[ 
https://issues.apache.org/jira/browse/FREEMARKER-181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17350484#comment-17350484
 ] 

Siegfried Goeschl commented on FREEMARKER-181:
----------------------------------------------

* Changed `GrokTool#compile` to `GrokTool#create` to indicate the creation of a 
`Grok` instance
* Expose `GrokTool#grokCompiler`

> [freemarker-generator] Support custom pattern definitions for Grok tool
> -----------------------------------------------------------------------
>
>                 Key: FREEMARKER-181
>                 URL: https://issues.apache.org/jira/browse/FREEMARKER-181
>             Project: Apache Freemarker
>          Issue Type: Bug
>            Reporter: Siegfried Goeschl
>            Assignee: Siegfried Goeschl
>            Priority: Minor
>
> Need to parse through a bunch of server log files to extract response times 
> but I want to define the required pattern definitions directly in the FTL 
> instead of changing "/patterns/patterns".
> So something like this should work
> {code:java}
> <#assign patternDefinitions = {
> "MY_DATE": "%{YEAR}-%{MONTHNUM}-%{MONTHDAY}",
> "MY_TIMESTAMP": "%{MY_DATE:date} %{TIME:time},%{INT:millis}",
> "MY_MODULE": "\\[%{NOTSPACE}\\]",
> "MY_THREAD": "\\(%{NOTSPACE}\\)",
> "MY_SERVERLOG": "%{MY_TIMESTAMP} %{LOGLEVEL}%{SPACE:UNWANTED}%{MY_MODULE} 
> %{MY_THREAD} message response handled in: %{INT:response_time} ms; 
> %{GREEDYDATA:UNWANTED}"
> }>
> <#assign grok = tools.grok.create("%{MY_SERVERLOG}", patternDefinitions)>
> {code}
> while still being able to use the existing Grok patterns file.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to