Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

Turn Text into Attributes

avatar

Hi everyone,

I use NiFi to frequently check if a website is up or down. I get the following response as text in a single Flowfile:

HTTP/1.1: 200 Connection established
Proxy-Agent: Fortinet-Proxy/1.0
Content-Type: image/jpeg
Connection: keep-alive
Date: Tue, 12 Sep 2023 14:05:43 GMT
Server: Apache
Strict-Transport-Security: max-age=31536000
URL: https://test.com

 How can I turn these lines into Key/Value-Pairs or Attributes, to use them with further processors? My goal is to save these Informations in an mySQL Database where the following fields are given:

  • HTTP/1.1
  • Proxy-Agent
  • Content-Type
  • Connection
  • Date
  • ...

Best regards

Maik

1 ACCEPTED SOLUTION

avatar
Super Guru

Hi @CommanderLaus ,

The easiest way I can think of is to use the ExtractText Processor where you define an attribute as dynamic property and assign the Regex as follows:

SAMSAL_0-1694534042115.png

I did only the first three fields but you can do the others the same way.

If that helps please accept solution.

Thanks

View solution in original post

2 REPLIES 2

avatar
Super Guru

Hi @CommanderLaus ,

The easiest way I can think of is to use the ExtractText Processor where you define an attribute as dynamic property and assign the Regex as follows:

SAMSAL_0-1694534042115.png

I did only the first three fields but you can do the others the same way.

If that helps please accept solution.

Thanks

avatar

Hi @SAMSAL ,

that's pretty simple, but works fine for me. Thanks for the advice.

Regards
Maik