Layer7 API Management

Expand all | Collapse all

It is possible to setup Custom Logger to write to Syslog server using restman API?

Jump to Best Answer
  • 1.  It is possible to setup Custom Logger to write to Syslog server using restman API?

    Posted 02-20-2019 04:26 PM

    These manual steps but using restman API:

    1. Task -> Logging and Auditing -> Manage Log/Audit Sinks > Create 

     

     

     



  • 2.  Re: It is possible to setup Custom Logger to write to Syslog server using restman API?
    Best Answer

    Posted 02-20-2019 06:12 PM

    example: (change property value accordingly)

     

    ### create new syslog logsink
    POST https://<gateway>:9443/restman/1.0/logSinks

    (basic authentication required)
    Content-Type:application/xml
    body:

     

    <l7:LogSink  xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
      <l7:Name>syslog</l7:Name>
      <l7:Description>test</l7:Description>
      <l7:Type>SYSLOG</l7:Type>
      <l7:Categories>
        <l7:Category>AUDIT</l7:Category>
        <l7:Category>LOG</l7:Category>
      </l7:Categories>
      <l7:Enabled>false</l7:Enabled>
      <l7:Severity>INFO</l7:Severity>
      <l7:SyslogHosts>
        <l7:StringValue>localhost:514</l7:StringValue>
      </l7:SyslogHosts>
      <l7:Filters />
      <l7:Properties>
        <l7:Property key="syslog.charSet">
          <l7:StringValue>UTF-8</l7:StringValue>
        </l7:Property>
        <l7:Property key="syslog.facility">
          <l7:StringValue>16</l7:StringValue>
        </l7:Property>
        <l7:Property key="syslog.format">
          <l7:StringValue>STANDARD</l7:StringValue>
        </l7:Property>
        <l7:Property key="syslog.logHostname">
          <l7:StringValue>true</l7:StringValue>
        </l7:Property>
        <l7:Property key="syslog.protocol">
          <l7:StringValue>TCP</l7:StringValue>
        </l7:Property>
        <l7:Property key="syslog.ssl.clientAuth">
          <l7:StringValue>false</l7:StringValue>
        </l7:Property>
        <l7:Property key="syslog.ssl.key.alias">
          <l7:Value>
            <l7:Item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
          </l7:Value>
        </l7:Property>
        <l7:Property key="syslog.ssl.keystore.id">
          <l7:Value>
            <l7:Item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
          </l7:Value>
        </l7:Property>
        <l7:Property key="syslog.timezone">
          <l7:Value>
            <l7:Item xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true" />
          </l7:Value>
        </l7:Property>
      </l7:Properties>
    </l7:LogSink>



  • 3.  Re: It is possible to setup Custom Logger to write to Syslog server using restman API?

    Posted 02-20-2019 07:26 PM

    When I created a log sink manually and try to pull from the url. I don't get a list of log sinks.

     

    <l7:Type>NotFound</l7:Type>
    <l7:TimeStamp>2019-02-20T19:23:40.572-05:00</l7:TimeStamp>
    <l7:Link rel="self" uri="Mygatewayurl:9443/restman/1.0/logSinks"/>
    <l7:Detail>HTTP 404 Not Found</l7:Detail>
    </l7:Error>
    it should show the default log sinks as well, but it's 404.


  • 4.  Re: It is possible to setup Custom Logger to write to Syslog server using restman API?

    Posted 02-20-2019 09:29 PM

    It doesn't make sense, the url is correct.

    Do you publish the Gateway REST Management Service yet?

    What's the version of your gateway?



  • 5.  Re: It is possible to setup Custom Logger to write to Syslog server using restman API?

    Posted 02-20-2019 09:35 PM

    9.2. 



  • 6.  Re: It is possible to setup Custom Logger to write to Syslog server using restman API?

    Posted 02-20-2019 10:39 PM

    unfortunately, the log sink is not available on gateway 9.2, since gateway 9.3, the restman is enhanced, you may need to upgrade to gateway 9.3 or above.



  • 7.  Re: It is possible to setup Custom Logger to write to Syslog server using restman API?

    Posted 02-21-2019 12:14 AM

    Thank you for the answer.