<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Put error message in PutEmail message body in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349754#M235760</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is I'm executing the python script using the above given flow using &lt;SPAN&gt;ExecuteStreamCommand every 5 mins. But when the python script fails it create one log file at some location of another server. &lt;STRONG&gt;I want to attach that log file to the mail which we are putting it using PutEmail processor.&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Aug 2022 08:50:20 GMT</pubDate>
    <dc:creator>VJ_0082</dc:creator>
    <dc:date>2022-08-09T08:50:20Z</dc:date>
    <item>
      <title>Put error message in PutEmail message body</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349617#M235703</link>
      <description>&lt;P&gt;Hi All,&lt;BR /&gt;&lt;BR /&gt;I want to put the error message or want to attach the log file from local location to the nifi flow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My flow is as below:&lt;/P&gt;&lt;P&gt;Getfile -&amp;gt; EvaluateJSON -&amp;gt; ExecuteStreamCommand-&amp;gt;RouteAttribute-&amp;gt; PutEmail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me for this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!!&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 09:44:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349617#M235703</guid>
      <dc:creator>VJ_0082</dc:creator>
      <dc:date>2022-08-05T09:44:05Z</dc:date>
    </item>
    <item>
      <title>Re: Put error message in PutEmail message body</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349636#M235706</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99640"&gt;@VJ_0082&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;Your use case is not very clear.&amp;nbsp; What exactly are you trying to accomplish via your existing dataflow and what issues are you having?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 15:12:42 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349636#M235706</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-08-05T15:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: Put error message in PutEmail message body</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349640#M235710</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to get the mails after the failure of flow with the error message in the mail.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Aug 2022 16:32:01 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349640#M235710</guid>
      <dc:creator>VJ_0082</dc:creator>
      <dc:date>2022-08-05T16:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Put error message in PutEmail message body</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349706#M235748</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99640"&gt;@VJ_0082&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;When a NiFi processor errors it will produce a bulletin.&amp;nbsp; NiFi has a &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-site-to-site-reporting-nar/1.17.0/org.apache.nifi.reporting.SiteToSiteBulletinReportingTask/index.html" target="_self"&gt;SiteToSiteBulletin&lt;/A&gt;&amp;nbsp; reporting task.&amp;nbsp; This reporting task can send these produced bulletins to a &lt;A href="https://nifi.apache.org/docs/nifi-docs/html/user-guide.html#adding-components-to-the-canvas" target="_self"&gt;remote input port&lt;/A&gt; on either the same NiFi or a completely different NiFi.&amp;nbsp; You can construct a dataflow from that remote input port to route these FlowFiles to your putEmail processor.&amp;nbsp; &amp;nbsp;Constructing a dataflow like this avoids needing to deal with non error related log output or ingesting same log lines over and over by re-reading the app.log.&lt;BR /&gt;&lt;BR /&gt;By default processors have their bulletin level set to ERROR, but you can change that on each processor if so desired.&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Mon, 08 Aug 2022 12:16:13 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349706#M235748</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-08-08T12:16:13Z</dc:date>
    </item>
    <item>
      <title>Re: Put error message in PutEmail message body</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349754#M235760</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I want is I'm executing the python script using the above given flow using &lt;SPAN&gt;ExecuteStreamCommand every 5 mins. But when the python script fails it create one log file at some location of another server. &lt;STRONG&gt;I want to attach that log file to the mail which we are putting it using PutEmail processor.&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Aug 2022 08:50:20 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349754#M235760</guid>
      <dc:creator>VJ_0082</dc:creator>
      <dc:date>2022-08-09T08:50:20Z</dc:date>
    </item>
    <item>
      <title>Re: Put error message in PutEmail message body</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349866#M235800</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99640"&gt;@VJ_0082&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;So you custom PythonScript executes and when it errors, a log is written on some host other than the host where NiFi is running?&amp;nbsp; The GetFile processor can only get files from the local filesystem.&amp;nbsp; I can get files from a remote filesystem (unless that remote file system is locally mounted).&lt;BR /&gt;&lt;BR /&gt;What is the error and stack trace your are seeing in the nifi-app.log when your PutEmail processor executes against your source FlowFile?&amp;nbsp; Do you have a sample of FlowFile content being passed to the PutEmail processor?&amp;nbsp; &amp;nbsp;How has your PutEmail processor been configured?&lt;BR /&gt;&lt;BR /&gt;Matt&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 10 Aug 2022 13:03:03 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349866#M235800</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-08-10T13:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: Put error message in PutEmail message body</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349924#M235821</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Kindly find the below flow. After the ExecuteStreamCommand the log file will be created when the output is failed with the content in log file as shown below. So, either way i have to do that is either attach the log file to mail or paste that content in mail.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Nifi Flow:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Nifi_Flow.PNG" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/35144i3227EA90F1267FF1/image-size/large?v=v2&amp;amp;px=999" role="button" title="Nifi_Flow.PNG" alt="Nifi_Flow.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log File Content:&lt;/P&gt;&lt;P&gt;2022-07-27 21:18:48,574&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt;File "File_upload.py", line 121, in &amp;lt;module&amp;gt;&lt;BR /&gt;shell_exec(query)&lt;BR /&gt;File "File_upload.py", line 28, in shell_exec&lt;BR /&gt;raise Exception(stderr)&lt;BR /&gt;Exception: mv: `/abc/xyz/abc_xyz_stg/configs_enc/COMMON/archive/ENV/env_uat_v_3.json': No such file or directory: `hdfs://cluster/abc/xyz/abc_xyz_stg/configs_enc/COMMON/archive/ENV/env_uat_v_3.json'&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 05:47:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349924#M235821</guid>
      <dc:creator>VJ_0082</dc:creator>
      <dc:date>2022-08-11T05:47:30Z</dc:date>
    </item>
    <item>
      <title>Re: Put error message in PutEmail message body</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349974#M235838</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99640"&gt;@VJ_0082&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;I apologize if I am still not clear about your Script being executed by ExecuteStream command.&lt;BR /&gt;&lt;BR /&gt;The Script is writing to some log file on disk where (locally on the NiFi node host or some external server where NiFi is not located) when it fails/errors?&lt;BR /&gt;&lt;BR /&gt;I assume your flow is passing the "original" FlowFile with a new FlowFile Attribute "&lt;SPAN&gt;execution.error" with your exception/error in it?&amp;nbsp; &amp;nbsp;Does this attribute contain the details you want to send in your email?&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Then you are routing based on what attribute from Original FlowFile (&lt;SPAN&gt;execution.status)&lt;/SPAN&gt;?&lt;BR /&gt;&lt;BR /&gt;How is your PutEmail processor configured.&amp;nbsp; It can be configured to send either a FlowFiIe&amp;nbsp; attribute or FlowFile content.&lt;BR /&gt;&lt;BR /&gt;If the content you to sent via PutEmail is not in the Content of the FlowFile and is also Not in a FlowFile Attribute on the FlowFile, but rather written to some location on disk, you would need a separate dataflow that watches that log file on disk for new entries ingesting them into a FlowFile that feeds a putEmial processor.&amp;nbsp; This could be accomplished using the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.17.0/org.apache.nifi.processors.standard.TailFile/index.html" target="_self"&gt;TailFile&lt;/A&gt; processor.&amp;nbsp; If that content is being written out a log file on remote system that becomes a different challenge.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;</description>
      <pubDate>Thu, 11 Aug 2022 18:49:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/349974#M235838</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-08-11T18:49:44Z</dc:date>
    </item>
    <item>
      <title>Re: Put error message in PutEmail message body</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/350091#M235879</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/99640"&gt;@VJ_0082&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Since your log is being generated on a remote server, You will need to use a processor that can remotely connect to the exteranl server to retrieve that log&lt;BR /&gt;&lt;BR /&gt;Possible designs:&lt;BR /&gt;1. The could incorporate a&amp;nbsp;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.17.0/org.apache.nifi.processors.standard.FetchSFTP/index.html" target="_self"&gt;FetchSFTP&lt;/A&gt; processor in to your existing flow.&amp;nbsp; I assume your existing &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.17.0/org.apache.nifi.processors.standard.RouteOnAttribute/index.html" target="_self"&gt;RouteOnAttriibute&lt;/A&gt; processor is checking for when an error happens with your script?&amp;nbsp; If so, add the FetchSFTP processor between this processor and your &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.17.0/org.apache.nifi.processors.standard.PutEmail/index.html" target="_self"&gt;PutEmail&lt;/A&gt; processor.&amp;nbsp; &amp;nbsp;Configured the&amp;nbsp;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.17.0/org.apache.nifi.processors.standard.FetchSFTP/index.html" target="_self"&gt;FetchSFTP&lt;/A&gt; processor&amp;nbsp;&lt;SPAN&gt;(configured with "&lt;STRONG&gt;Completion Strategy&lt;/STRONG&gt;" of DELETE)&amp;nbsp;&lt;/SPAN&gt;fetch the specific log file created.&amp;nbsp; This dataflow assumes the log's filename is always the same.&lt;BR /&gt;&lt;BR /&gt;2. This second flow could be built using the &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.17.0/org.apache.nifi.processors.standard.ListSFTP/index.html" target="_self"&gt;ListSFTP&lt;/A&gt; (configured with filename filter) --&amp;gt; &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.17.0/org.apache.nifi.processors.standard.FetchSFTP/index.html" target="_self"&gt;FetchSFTP&lt;/A&gt; --&amp;gt; any processors you want to use to manipulate log --&amp;gt;&lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.17.0/org.apache.nifi.processors.standard.PutEmail/index.html" target="_self"&gt; PutEmail&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;The ListSFTP processor would be configured to execute on "primary" node and be configured with a "&lt;SPAN&gt;&lt;STRONG&gt;File Filter Regex&lt;/STRONG&gt;".&amp;nbsp; When your 5 minute flow runs and if it encounters an exception resulting in the creation of the log file, this listSFTP processor will see that file and list it (0 byte FlowFile).&amp;nbsp; That FlowFile will have all the FlowFile attributes needed for the FetchSFTP processor (configured with "&lt;STRONG&gt;Completion Strategy&lt;/STRONG&gt;" of DELETE) to fetch the log which&amp;nbsp;is added to the content of the existing FlowFile.&amp;nbsp; If you do not need to extract from or modify that content, your next processor could just be the PutFile processor.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;If you found this response assisted with your query, please take a moment to login and click on "&lt;STRONG&gt;Accept as Solution&lt;/STRONG&gt;" below this post.&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;/P&gt;&lt;P&gt;Matt&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 14:50:41 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Put-error-message-in-PutEmail-message-body/m-p/350091#M235879</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-08-15T14:50:41Z</dc:date>
    </item>
  </channel>
</rss>

