Layer7 API Management

Expand all | Collapse all

How can we configure email alert for any newly published service on API Gateway

Jump to Best Answer
  • 1.  How can we configure email alert for any newly published service on API Gateway

    Posted 07-27-2018 06:21 AM

    Hi,

     

    How can we create an email alert if any new API is published or any API is updated.

    Please help on this.

     

    Thanks,



  • 2.  Re: How can we configure email alert for any newly published service on API Gateway

    Posted 07-27-2018 06:26 AM

    Hi irfan,

     

    you can configure the assertion in the service to trigger mail from the gateway. Docops link is below 

    Send Email Alert Assertion - CA API Gateway - 9.3 - CA Technologies Documentation 

     

    I guess this is what you are looking for. 

     

    Regards,

    Grajesh



  • 3.  Re: How can we configure email alert for any newly published service on API Gateway

    Posted 07-27-2018 06:34 AM

    Hi Grajesh,

     

    The Send Email Alert Assertion will only send the email depending upon how we use it in the policy.

     

    But my requirement is to trigger an email automatically if any new service is published on the gateway or any service is updated.

     

     

    Thanks,



  • 4.  Re: How can we configure email alert for any newly published service on API Gateway
    Best Answer

    Posted 07-27-2018 08:26 PM

    Hi Irfan,

     

    I honestly don't think the Gateway has the capability right now built-in to send an email every time a new service is created on it. If it exists, I'm definitely missing it at the moment while I think of this use-case. I think it's a great idea though for a future update of the Gateway. In such a case, I encourage creating a new idea in the CA API Management Community here, where it can be voted on and product managers can interface with everyone publicly about the feature request.

     

    Also, as this might matter, who is your target audience with this use-case? Is it just other system admins of the Gateway, or is it developers/customers of yours, etc.? Because there may be another way to achieve a similar use-case if it's for local admins, for example. It just may not be through email. This wouldn't be supported in any way, but I can imagine a tool of some sort that might monitor the specific table holding the service names in the ssg database and emails when it detects changes to specific fields or the count of rows change, for example. But again, such a thing would not be supported, but I would think it's theoretically possible and a tool may already exist to monitor database content for a similar use-case as yours.

     

    I hope the above helps a bit, even if it may not be the answer you were hoping for.

     

    Sincerely,

     

    Dustin Dauncey

    Sr Support Engineer, Global Customer Success

    Email: Dustin.Dauncey@ca.com

    Phone: +1 800 225 5224, 48385

    Phone if outside North America: https://tinyurl.com/CAContactSupport

    CA API Management Community: https://tinyurl.com/CAAPIMCommunity

     

     



  • 5.  Re: How can we configure email alert for any newly published service on API Gateway

    Posted 07-28-2018 01:25 AM

    Hi Dustin,

     

    Thank you for your reply.

     

    I guess this can be achieved by using audit sink policy. Whenever a service is published or updated an audit is generated so in audit we can read it using convert the audit to XML Assertion and trigger a mail depending on that through policy logic.

     

    But I don't know to develop it. Please let me know if it's feasible. It will be a great help

     

     

    Thanks



  • 6.  Re: How can we configure email alert for any newly published service on API Gateway

    Posted 07-30-2018 05:32 PM

    Hi Irfan,

     

    Your suggestion may be worth exploring, for sure. I think it may be possible, or at least may be something on the right track. I'm not sure how I can help you "develop it” though, as there would need to be a lot of trial and error in your environment since this is not an out-of-the-box supported method in the Gateway at this point in time.

     

    We do have CA Services which can be of some assistance as they specialize in customizations and unique use-cases, if you're interested. They are a paid service, however. If you are interested in learning more about how CA Services might be able to help you achieve this use-case, it's typically best to communicate this through your CA Account Executive. If you do now know who that is though, please let me know and I can try to get someone to reach out to you (I may need you to message me with your contact details outside of this thread, however).

     

    Thank you, Irfan, for your time. And if you haven't already I would still suggest creating a new idea in the CA API Management Community here to make a use-case like this one easy to use with a supported built-in feature.



  • 7.  Re: How can we configure email alert for any newly published service on API Gateway

    Posted 07-30-2018 07:12 PM

    Hi Irfan,

     

    Adding to what Dustin said, true, we do not have OOTB such an option.

     

    With that said, if one looks at the audit messages of a newly created published service and an updated one, one can see the difference  and capture the needed text using the XML parse option we have in the Policy Manager.

     

    The idea behind it is to turn the internal Audit sink policy so we can "capture" the audit of the created/published service and parse out the needed information.

     

    For example a newly published created service will have in its Audit something like:

     

    PublishedService #e5f6044bf2c4b135575b67847567802a (newapi) updated (set policy)

     

    Whereas an updated one would have something like:

     

    Policy #e5f6044bf2c4b135575b67847567802c (Policy for service #e5f6044bf2c4b135575b67847567802a, newapi) updated (changed xml)

     

    So if we capture/parse out the "PublishedService" + "(newapi)" + (set policy)" we can 'tell' that this is a newly created/published service and trigger an email alert based on this condition.

     

    Another option is to integrate with CA Precision API Monitor product and use its EPAgent (which part of the integration is installed on the Gateway and monitor also the SSG log) to parse the Gateway SSG log and again, capture/parse the needed data and trigger an alert using a command line.

     

    Going back to what Dustin mentioned - both options are a customized solution (which can be done) and CA Professional Service team can assist if required (as a paid service).

     

    Hope this helps in guiding you to your needed path.

     

    Regards,

     

    Amit.



  • 8.  Re: How can we configure email alert for any newly published service on API Gateway

    Posted 01-09-2019 03:24 AM

    Hello Everyone,

     

    Just Created an Audit Sink Polciy Which will send an Email Alert whenever a New Service is Published or Updated.

    PFB Audit Sink policy. Publish an Audit Sink Policy and Paste the below Code into that policy and configure your smtp details and you are good to go.

     

    <?xml version="1.0" encoding="UTF-8"?>
    <exp:Export Version="3.0"
    xmlns:L7p="http://www.layer7tech.com/ws/policy"
    xmlns:exp="http://www.layer7tech.com/ws/policy/export" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
    <exp:References/>
    <wsp:Policy xmlns:L7p="http://www.layer7tech.com/ws/policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2002/12/policy">
    <wsp:All wsp:Usage="Required">
    <L7p:CommentAssertion>
    <L7p:Comment stringValue="A simple audit sink policy could convert the audit record to XML, then post it somewhere via HTTP"/>
    </L7p:CommentAssertion>
    <L7p:AuditAssertion/>
    <L7p:AuditRecordToXml/>
    <L7p:AuditDetailAssertion>
    <L7p:Detail stringValue="audit Message ${request.mainpart}"/>
    <L7p:LoggingOnly booleanValue="true"/>
    </L7p:AuditDetailAssertion>
    <L7p:RequestXpathAssertion>
    <L7p:VariablePrefix stringValue="mess"/>
    <L7p:XpathExpression xpathExpressionValue="included">
    <L7p:Expression stringValue="/ns:audit/ns:message"/>
    <L7p:Namespaces mapValue="included">
    <L7p:entry>
    <L7p:key stringValue="ns"/>
    <L7p:value stringValue="http://l7tech.com/audit/rec"/>
    </L7p:entry>
    <L7p:entry>
    <L7p:key stringValue="s"/>
    <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
    </L7p:entry>
    </L7p:Namespaces>
    <L7p:XpathVersion xpathVersion="XPATH_1_0"/>
    </L7p:XpathExpression>
    </L7p:RequestXpathAssertion>
    <wsp:OneOrMore wsp:Usage="Required">
    <wsp:All wsp:Usage="Required">
    <wsp:OneOrMore wsp:Usage="Required">
    <L7p:ComparisonAssertion>
    <L7p:CaseSensitive booleanValue="false"/>
    <L7p:Expression1 stringValue="${mess.result}"/>
    <L7p:Expression2 stringValue="PublishedService"/>
    <L7p:Operator operator="CONTAINS"/>
    <L7p:Predicates predicates="included">
    <L7p:item binary="included">
    <L7p:CaseSensitive booleanValue="false"/>
    <L7p:Operator operator="CONTAINS"/>
    <L7p:RightValue stringValue="PublishedService"/>
    </L7p:item>
    </L7p:Predicates>
    </L7p:ComparisonAssertion>
    <L7p:ComparisonAssertion>
    <L7p:CaseSensitive booleanValue="false"/>
    <L7p:Expression1 stringValue="${mess.result}"/>
    <L7p:Expression2 stringValue="updated"/>
    <L7p:Operator operator="CONTAINS"/>
    <L7p:Predicates predicates="included">
    <L7p:item binary="included">
    <L7p:CaseSensitive booleanValue="false"/>
    <L7p:Operator operator="CONTAINS"/>
    <L7p:RightValue stringValue="updated"/>
    </L7p:item>
    </L7p:Predicates>
    </L7p:ComparisonAssertion>
    </wsp:OneOrMore>
    <L7p:EmailAlert>
    <L7p:Base64message stringValue="JHttZXNzLnJlc3VsdH0="/>
    <L7p:SmtpHost stringValue="xxxxx"/>
    <L7p:SourceEmailAddress stringValue="xx@***.com"/>
    <L7p:TargetEmailAddress stringValue="xxxxx@***.com"/>
    </L7p:EmailAlert>
    </wsp:All>
    <L7p:TrueAssertion/>
    </wsp:OneOrMore>
    <wsp:OneOrMore L7p:Enabled="false" wsp:Usage="Required">
    <wsp:All wsp:Usage="Required">
    <wsp:OneOrMore wsp:Usage="Required">
    <L7p:ComparisonAssertion>
    <L7p:CaseSensitive booleanValue="false"/>
    <L7p:Expression1 stringValue="${audit.type}"/>
    <L7p:Operator operatorNull="null"/>
    <L7p:Predicates predicates="included">
    <L7p:item dataType="included">
    <L7p:Type variableDataType="string"/>
    </L7p:item>
    <L7p:item binary="included">
    <L7p:RightValue stringValue="admin"/>
    </L7p:item>
    </L7p:Predicates>
    </L7p:ComparisonAssertion>
    <L7p:ComparisonAssertion>
    <L7p:CaseSensitive booleanValue="false"/>
    <L7p:Expression1 stringValue="${audit.type}"/>
    <L7p:Operator operatorNull="null"/>
    <L7p:Predicates predicates="included">
    <L7p:item dataType="included">
    <L7p:Type variableDataType="string"/>
    </L7p:item>
    <L7p:item binary="included">
    <L7p:RightValue stringValue="system"/>
    </L7p:item>
    </L7p:Predicates>
    </L7p:ComparisonAssertion>
    </wsp:OneOrMore>
    <L7p:RequestXpathAssertion>
    <L7p:VariablePrefix stringValue="auditCode"/>
    <L7p:XpathExpression xpathExpressionValue="included">
    <L7p:Expression stringValue="/ns:audit/@level"/>
    <L7p:Namespaces mapValue="included">
    <L7p:entry>
    <L7p:key stringValue="ns"/>
    <L7p:value stringValue="http://l7tech.com/audit/rec"/>
    </L7p:entry>
    <L7p:entry>
    <L7p:key stringValue="s"/>
    <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
    </L7p:entry>
    </L7p:Namespaces>
    <L7p:XpathVersion xpathVersion="XPATH_1_0"/>
    </L7p:XpathExpression>
    </L7p:RequestXpathAssertion>
    <L7p:RequestXpathAssertion>
    <L7p:VariablePrefix stringValue="auditName"/>
    <L7p:XpathExpression xpathExpressionValue="included">
    <L7p:Expression stringValue="/ns:audit/ns:user/@name"/>
    <L7p:Namespaces mapValue="included">
    <L7p:entry>
    <L7p:key stringValue="ns"/>
    <L7p:value stringValue="http://l7tech.com/audit/rec"/>
    </L7p:entry>
    <L7p:entry>
    <L7p:key stringValue="s"/>
    <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
    </L7p:entry>
    </L7p:Namespaces>
    <L7p:XpathVersion xpathVersion="XPATH_1_0"/>
    </L7p:XpathExpression>
    </L7p:RequestXpathAssertion>
    <L7p:RequestXpathAssertion>
    <L7p:VariablePrefix stringValue="auditMessage"/>
    <L7p:XpathExpression xpathExpressionValue="included">
    <L7p:Expression stringValue="/ns:audit/ns:message"/>
    <L7p:Namespaces mapValue="included">
    <L7p:entry>
    <L7p:key stringValue="ns"/>
    <L7p:value stringValue="http://l7tech.com/audit/rec"/>
    </L7p:entry>
    <L7p:entry>
    <L7p:key stringValue="s"/>
    <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
    </L7p:entry>
    </L7p:Namespaces>
    <L7p:XpathVersion xpathVersion="XPATH_1_0"/>
    </L7p:XpathExpression>
    </L7p:RequestXpathAssertion>
    <L7p:SetVariable>
    <L7p:Base64Expression stringValue="ew0KICAidmVyc2lvbiI6ICIxLjEiLA0KICAiaG9zdCI6ICIke3NzZ25vZGUubmFtZX0iLA0KICAic2hvcnRfbWVzc2FnZSI6ICJDQSBBUEkgR2F0ZXdheSBBdWRpdCBTeW5jIE1lc3NhZ2UgKCR7YXVkaXQudHlwZX0pIiwNCiAgImZ1bGxfbWVzc2FnZSI6ICIke2F1ZGl0TWVzc2FnZS5yZXN1bHR9IiwNCiAgImxldmVsIjogJHthdWRpdENvZGUucmVzdWx0fSwNCiAgImluZm9fdXNlcklkIjogIiR7YXVkaXROYW1lLnJlc3VsdH0iDQp9"/>
    <L7p:ContentType stringValue="application/json; charset=utf-8"/>
    <L7p:DataType variableDataType="message"/>
    <L7p:VariableToSet stringValue="graylogPayload"/>
    </L7p:SetVariable>
    <L7p:HttpRoutingAssertion>
    <L7p:ConnectionTimeout stringValue="500"/>
    <L7p:HttpMethod httpMethod="POST"/>
    <L7p:MaxRetries intValue="0"/>
    <L7p:ProtectedServiceUrl stringValue="http://hugst05-graylog.ca.com:12201/gelf"/>
    <L7p:ProxyPassword stringValueNull="null"/>
    <L7p:ProxyUsername stringValueNull="null"/>
    <L7p:RequestHeaderRules httpPassthroughRuleSet="included">
    <L7p:ForwardAll booleanValue="true"/>
    <L7p:Rules httpPassthroughRules="included">
    <L7p:item httpPassthroughRule="included">
    <L7p:Name stringValue="Cookie"/>
    </L7p:item>
    <L7p:item httpPassthroughRule="included">
    <L7p:Name stringValue="SOAPAction"/>
    </L7p:item>
    </L7p:Rules>
    </L7p:RequestHeaderRules>
    <L7p:RequestMsgSrc stringValue="graylogPayload"/>
    <L7p:RequestParamRules httpPassthroughRuleSet="included">
    <L7p:ForwardAll booleanValue="true"/>
    <L7p:Rules httpPassthroughRules="included"/>
    </L7p:RequestParamRules>
    <L7p:ResponseHeaderRules httpPassthroughRuleSet="included">
    <L7p:ForwardAll booleanValue="true"/>
    <L7p:Rules httpPassthroughRules="included">
    <L7p:item httpPassthroughRule="included">
    <L7p:Name stringValue="Set-Cookie"/>
    </L7p:item>
    </L7p:Rules>
    </L7p:ResponseHeaderRules>
    <L7p:SamlAssertionVersion intValue="2"/>
    <L7p:Timeout stringValue="750"/>
    <L7p:UseKeepAlives booleanValue="false"/>
    </L7p:HttpRoutingAssertion>
    </wsp:All>
    <wsp:All wsp:Usage="Required">
    <L7p:RequestXpathAssertion>
    <L7p:VariablePrefix stringValue="auditCode"/>
    <L7p:XpathExpression xpathExpressionValue="included">
    <L7p:Expression stringValue="/ns:audit/@level"/>
    <L7p:Namespaces mapValue="included">
    <L7p:entry>
    <L7p:key stringValue="ns"/>
    <L7p:value stringValue="http://l7tech.com/audit/rec"/>
    </L7p:entry>
    <L7p:entry>
    <L7p:key stringValue="s"/>
    <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
    </L7p:entry>
    </L7p:Namespaces>
    <L7p:XpathVersion xpathVersion="XPATH_1_0"/>
    </L7p:XpathExpression>
    </L7p:RequestXpathAssertion>
    <L7p:RequestXpathAssertion>
    <L7p:VariablePrefix stringValue="auditMessage"/>
    <L7p:XpathExpression xpathExpressionValue="included">
    <L7p:Expression stringValue="/ns:audit/ns:message"/>
    <L7p:Namespaces mapValue="included">
    <L7p:entry>
    <L7p:key stringValue="ns"/>
    <L7p:value stringValue="http://l7tech.com/audit/rec"/>
    </L7p:entry>
    <L7p:entry>
    <L7p:key stringValue="s"/>
    <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
    </L7p:entry>
    </L7p:Namespaces>
    <L7p:XpathVersion xpathVersion="XPATH_1_0"/>
    </L7p:XpathExpression>
    </L7p:RequestXpathAssertion>
    <L7p:RequestXpathAssertion>
    <L7p:VariablePrefix stringValue="auditServiceName"/>
    <L7p:XpathExpression xpathExpressionValue="included">
    <L7p:Expression stringValue="/ns:audit/@name"/>
    <L7p:Namespaces mapValue="included">
    <L7p:entry>
    <L7p:key stringValue="ns"/>
    <L7p:value stringValue="http://l7tech.com/audit/rec"/>
    </L7p:entry>
    <L7p:entry>
    <L7p:key stringValue="s"/>
    <L7p:value stringValue="http://schemas.xmlsoap.org/soap/envelope/"/>
    </L7p:entry>
    </L7p:Namespaces>
    <L7p:XpathVersion xpathVersion="XPATH_1_0"/>
    </L7p:XpathExpression>
    </L7p:RequestXpathAssertion>
    <L7p:SetVariable>
    <L7p:Base64Expression stringValue="ew0KICAidmVyc2lvbiI6ICIxLjEiLA0KICAiaG9zdCI6ICIke3NzZ25vZGUubmFtZX0iLA0KICAic2hvcnRfbWVzc2FnZSI6ICJDQSBBUEkgR2F0ZXdheSBBdWRpdCBTeW5jIE1lc3NhZ2UgKCR7YXVkaXQudHlwZX0pIiwNCiAgImZ1bGxfbWVzc2FnZSI6ICIke2F1ZGl0TWVzc2FnZS5yZXN1bHR9IiwNCiAgImxldmVsIjogJHthdWRpdENvZGUucmVzdWx0fSwNCiAgImF1ZGl0X3NlcnZpY2VfbmFtZSI6ICIke2F1ZGl0U2VydmljZU5hbWUucmVzdWx0fSINCn0="/>
    <L7p:ContentType stringValue="application/json; charset=utf-8"/>
    <L7p:DataType variableDataType="message"/>
    <L7p:VariableToSet stringValue="graylogPayload"/>
    </L7p:SetVariable>
    <L7p:HttpRoutingAssertion>
    <L7p:ConnectionTimeout stringValue="500"/>
    <L7p:HttpMethod httpMethod="POST"/>
    <L7p:MaxRetries intValue="0"/>
    <L7p:ProtectedServiceUrl stringValue="http://graylog.support.local:12201/gelf"/>
    <L7p:ProxyPassword stringValueNull="null"/>
    <L7p:ProxyUsername stringValueNull="null"/>
    <L7p:RequestHeaderRules httpPassthroughRuleSet="included">
    <L7p:ForwardAll booleanValue="true"/>
    <L7p:Rules httpPassthroughRules="included">
    <L7p:item httpPassthroughRule="included">
    <L7p:Name stringValue="Cookie"/>
    </L7p:item>
    <L7p:item httpPassthroughRule="included">
    <L7p:Name stringValue="SOAPAction"/>
    </L7p:item>
    </L7p:Rules>
    </L7p:RequestHeaderRules>
    <L7p:RequestMsgSrc stringValue="graylogPayload"/>
    <L7p:RequestParamRules httpPassthroughRuleSet="included">
    <L7p:ForwardAll booleanValue="true"/>
    <L7p:Rules httpPassthroughRules="included"/>
    </L7p:RequestParamRules>
    <L7p:ResponseHeaderRules httpPassthroughRuleSet="included">
    <L7p:ForwardAll booleanValue="true"/>
    <L7p:Rules httpPassthroughRules="included">
    <L7p:item httpPassthroughRule="included">
    <L7p:Name stringValue="Set-Cookie"/>
    </L7p:item>
    </L7p:Rules>
    </L7p:ResponseHeaderRules>
    <L7p:SamlAssertionVersion intValue="2"/>
    <L7p:Timeout stringValue="750"/>
    <L7p:UseKeepAlives booleanValue="false"/>
    </L7p:HttpRoutingAssertion>
    </wsp:All>
    </wsp:OneOrMore>
    <L7p:FalseAssertion/>
    </wsp:All>
    </wsp:Policy>
    </exp:Export>

     

     

    Thanks,

    Irfan