Tina,

I don't believe there are any processors right now that will count the number 
of occurrences
of some string in a FlowFile. I would recommend either using an ExecuteScript 
processor and
scripting it out in Groovy/Jython, or if you're comfortable enough with Java 
and want to get your
hands a bit dirtier, you could actually update the ScanContent processor to 
optionally count
the number of occurrences of each term in the dictionary, rather than simply 
routing to 'matched'
or 'unmatched'. Then we could have ScanContent provide attributes such as 
<Search Term> = <Occurrences>.

Thanks
-Mark

> On Nov 6, 2017, at 3:58 PM, tzhu <js.tianlu...@gmail.com> wrote:
> 
> Hi,
> 
> I have a text log file. I want to count the number of occurrences of strings
> in the file and store it in a SQL table. For example, I want to count the
> number of times the string "Established connection to server" present in the
> file as TOTAL_CONNECTIONS and the number of times "Lost connection to
> server" existed in the same file as TOTAL_DISCONNECTION.
> 
> I don't know how I should count the strings in this case. I find this blog
> as a template:  https://www.batchiq.com/database-injest-with-nifi.html
> <https://www.batchiq.com/database-injest-with-nifi.html>   Maybe I can
> modify things from this?
> 
> Any suggestions would be appreciated.
> 
> Thanks,
> 
> Tina
> 
> 
> 
> --
> Sent from: http://apache-nifi-developer-list.39713.n7.nabble.com/

Reply via email to