IBM Support

Use REST API to Administer the Log Analysis 1.3.5 data model.

Technical Blog Post


Abstract

Use REST API to Administer the Log Analysis 1.3.5 data model.

Body

This blog will discuss the procedure to use REST API to administer the Log Analysis 1.3.5 data model by running curl command from command line:

  

Step 1: Get Ltpatoken2

The command is:
curl -c cookie-jar.txt -X GET -k -i "https:// <LA_SERVER_IP> or <FQDN>: 9987/Unity/j_security_check?j_username=unityadmin&j_password=<unityadmin password> &action=Go"

        

For example, if you <FQDN> is laserver.domain1.com

curl -c cookie-jar.txt -X GET -k -i "https://laserver.domain1.com:9987/Unity/j_security_check?j_username=unityadmin&j_password=unityadmin&action=Go"
 

The following file will be produced in the same directory where you execute the above command:
1. cookie-jar.txt

  

Step 2. Get CSRFToken
 

The command is:
curl -L -b cookie-jar.txt -c cookie-search.txt -X GET -k -i "https://<LA_SERVER_IP> or <FQDN>:9987/Unity/j_security_check?j_username=unityadmin&j_password=<unityadmin password>&action=Go" |awk '{ print strftime("%c: "), $0; fflush(); }'| awk -F': ' '/var sclaidtoken =/' >> token.txt
 

For example:
curl -L -b cookie-jar.txt -c cookie-search.txt -X GET -k -i "https://laserver.domain1.com:9987/Unity/j_security_check?j_username=unityadmin&j_password=unityadmin&action=Go" |awk '{ print strftime("%c: "), $0; fflush(); }'| awk -F': ' '/var sclaidtoken =/' >> token.txt

The following file will be produced on the directory where you ran this command:
1. cookie-search.txt
2. token.txt

       

Step 3: Execute the action required.

Visit this page for instruction on executing the action required.
https://www.ibm.com/support/knowledgecenter/en/SSPFMY_1.3.5/com.ibm.scala.doc/admin/iwa_rest_services_api_ovw.html

           

For example, you want to list all the Data source, then you would visit this page after clicking Data sources link from the above page:
https://www.ibm.com/support/knowledgecenter/en/SSPFMY_1.3.5/com.ibm.scala.doc/admin/iwa_rest_api_logsources_c.html


The instructions to list all the Data source from the above link are:
https://<server>:<port>/Unity/Logsources?pattern=*
 

You would then perform this action:
curl -i -k -b cookie-search.txt -X GET "https://laserver.domain1.com:9987/Unity/Logsources?pattern=*"

  

An example of output is as below. This information shows that I have 2 Data sources currently, Test and db2test:
HTTP/1.1 200 OK
X-Powered-By: Servlet/3.0
Content-Type: application/json; charset=UTF-8
Content-Language: en-US
Transfer-Encoding: chunked
Date: Wed, 10 Apr 2019 08:35:13 GMT

[{"logsource_pk":1,"name":"Test","description":"","tag_id":4,"service_topology":""},{"logsource_pk":2,"name":"db2test","description":"","tag_id":4,"service_topology":""}]

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"","label":""},"Component":"","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"","label":""}}]

UID

ibm11081917