Support Questions

Find answers, ask questions, and share your expertise

Can oozie email actions include log files or standard output of other oozie actions?

avatar
Rising Star

I have an oozie java action that logs some basic information to standard out. The next oozie action is an email to me indicating success or failure. I would really like to include the prior action's standard out in that email. Is there a straight forward way to do that?

1 ACCEPTED SOLUTION

avatar
Rising Star

Oozie Email Action supports attachments of HDFS files. Because standard output files are written as local files, you need to copy them to HDFS first, then specify the path in the <attachment> tag of the email action.

<workflow-app name="[WF-DEF-NAME]" xmlns="uri:oozie:workflow:0.1">
    ...
    <action name="[NODE-NAME]">
        <email xmlns="uri:oozie:email-action:0.2">
            <to>[COMMA-SEPARATED-TO-ADDRESSES]</to>
            <cc>[COMMA-SEPARATED-CC-ADDRESSES]</cc> <!-- cc is optional -->
            <subject>[SUBJECT]</subject>
            <body>[BODY]</body>
            <content_type>[CONTENT-TYPE]</content_type> <!-- content_type is optional -->
            <attachment>[COMMA-SEPARATED-HDFS-FILE-PATHS]</attachment> <!-- attachment is optional -->
        </email>
        <ok to="[NODE-NAME]"/>
        <error to="[NODE-NAME]"/>
    </action>
    ...
</workflow-app>

View solution in original post

5 REPLIES 5

avatar
Rising Star

Oozie Email Action supports attachments of HDFS files. Because standard output files are written as local files, you need to copy them to HDFS first, then specify the path in the <attachment> tag of the email action.

<workflow-app name="[WF-DEF-NAME]" xmlns="uri:oozie:workflow:0.1">
    ...
    <action name="[NODE-NAME]">
        <email xmlns="uri:oozie:email-action:0.2">
            <to>[COMMA-SEPARATED-TO-ADDRESSES]</to>
            <cc>[COMMA-SEPARATED-CC-ADDRESSES]</cc> <!-- cc is optional -->
            <subject>[SUBJECT]</subject>
            <body>[BODY]</body>
            <content_type>[CONTENT-TYPE]</content_type> <!-- content_type is optional -->
            <attachment>[COMMA-SEPARATED-HDFS-FILE-PATHS]</attachment> <!-- attachment is optional -->
        </email>
        <ok to="[NODE-NAME]"/>
        <error to="[NODE-NAME]"/>
    </action>
    ...
</workflow-app>

avatar
New Contributor

hi! how do I know where the log / standard output / error is stored? you mention that it is stored locally. but where is that exactly? do you have an example? and how do you copy that into HDFS?

avatar
Rising Star

Can I do the same thing from HUE Oozie GUI ? If yes then from which version attachment is supported.

avatar
Master Mentor

@Vikas Gadade you will need to refer to the hue release notes for that.

avatar
Community Manager

@mattarellano, as this is an older post, you would have a better chance of receiving a resolution by starting a new thread. This will also be an opportunity to provide details specific to your environment that could aid others in assisting you with a more accurate answer to your question. You can link this thread as a reference in your new post.



Regards,

Vidya Sargur,
Community Manager


Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.
Learn more about the Cloudera Community: