Configuring and viewing syslog server information by using REST Administration APIs

You can specify syslog configuration by using REST Administration APIs.

The syslog object cannot be deleted by using the REST API DELETE method. To configure your syslog server, complete the following steps:

Use the Eclipse Amlen REST API POST method.
  1. Use the following Eclipse Amlen configuration URI:

    http://<admin-endpoint-IP:Port>/ima/v1/configuration/

  2. Provide log location configuration data in the payload of the POST method by using the following schema:
    
    "Syslog" 
    {    
        "Host" : "string",    
        "Port" : integer,   
        "Protocol" : "tcp" | "upd",    
        "Enabled" : true|false
    }
    where:
    Host
    Specifies the IP address of the syslog server.
    The default value is 127.0.0.1
    Port
    Specifies the port of the syslog server.
    The default value is 514.
    Protocol
    Specifies the protocol that is used.
    This value can be tcp or upd.
    The default value is tcp.
    Enabled
    Specifies whether the syslog server connection is enabled.
    This value can be true or false.
    The default value is false.
    Note: When Enabled is set to true, Eclipse Amlen attempts to establish a connection to the syslog server. If a connection cannot be established, a CWLNA0150 "Unable to connect" error is displayed. If Enabled is set to false, setting LocationType to syslog in LogLocation fails. If one or more LogLocation items use syslog, then syslog connectivity cannot be disabled by setting Enabled to false.
The following example updates the syslog server configuration by using cURL:
curl -X POST \
   -H  'Content-Type: application/json'  \
   -d  '{                       
           "Syslog": {   
             "Host" : "127.0.0.1",    
             "Port" : 514,   
             "Protocol" : "tcp",    
             "Enabled" : true
         }
      }
  '   \
http://127.0.0.1:9089/ima/v1/configuration/
An example response to the POST method:

{        
  "Version": "v1",
  "Code": "CWLNA6011",
  "Message": "The requested configuration change has completed successfully."
}

You can view syslog server configuration information by using the Eclipse Amlen REST API GET method with the following Eclipse Amlen configuration URI:

http://<admin-endpoint-IP:Port>/ima/v1/configuration/Syslog

The following example displays syslog server configuration information by using cURL:

curl -X GET http://127.0.0.1:9089/ima/v1/configuration/Syslog

An example response to the GET method:


{
  "Version": "v1",
  "Syslog": {
    "Host": "127.0.0.1",
    "Port": 514,
    "Protocol": "tcp",
    "Enabled": true
  }
}