Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

Solved Go to solution
Highlighted

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

Contributor

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

Accepted Solutions
Highlighted

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

Contributor

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

3 REPLIES 3
Highlighted

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

Contributor

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

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

Contributor

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

Highlighted

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

Mentor

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

Don't have an account?
Coming from Hortonworks? Activate your account here