How do I enable logging for Web Services in Spectrum?
search cancel

How do I enable logging for Web Services in Spectrum?

book

Article ID: 130413

calendar_today

Updated On:

Products

CA Spectrum DX NetOps

Issue/Introduction

How do I enable logging for RESTful Web Services in Spectrum?

Environment

CA Spectrum and REST architecture.

Cause

Looking at the definition of REST Architecture, it is a software architectural style that promotes standardized behaviors between interacting elements, or clients and servers. Conforming to the REST constraints is referred to as being RESTful. 
The REST architecture is a lightweight HTTP/HTTPS-based approach for SOAPless Web Services using create (POST), read (GET), update (PUT), and delete (DELETE) operations or verbs. 

RESTful architecture and applications are stateless, which means that no client context information is stored between requests. 
Each request contains all the information necessary to service the request.  
The CA Spectrum Web Services API supports the REST architecture but is also constrained by its stateless limitation.

Resolution

The localhost_access_log is not specific to REST calls so will contain a record for each REST call but does not contain much useful information.
When you run a web server, one of the output files normally generated is an access log, which generates one line of information for each request processed by the server, in a standard format.
It will log REST calls as it does all requests and is standard to the web server, in this case, tomcat.

What we can in Spectrum is is enable REST debug "RESTful Web Services" in OC Administration web server debug page.
e.g. I enabled it and posted an event as follows

<rs:event> 
<rs:target-models> 
<rs:model mh="0x4048e5x"/> 
</rs:target-models> 
<rs:event-type id="0x10002"/> 
<rs:varbind id="1">9</rs:varbind> 
<rs:varbind id="2">mem_instance</rs:varbind> 

here is the information that provides in the tomcat log.

Mar 29, 2019 04:56:26.718 (http-bio-80-exec-22) (RESTFULWEBSERVICES) - (DEBUG) - processing createEventByXML 
Mar 29, 2019 04:56:26.721 (http-bio-80-exec-22) (RESTFULWEBSERVICES) - (DEBUG) - number of events to create: 1 
user: spectrum 
host: 0:0:0:0:0:0:0:1
Mar 29, 2019 04:56:26.728 (http-bio-80-exec-22) (RESTFULWEBSERVICES) - (DEBUG) - creating event of type 65538 
number of target models: 1 
number of varbinds: 2 
Mar 29, 2019 04:56:26.732 (http-bio-80-exec-22) (RESTFULWEBSERVICES) - (DEBUG) - Event creation succeeded for target 0x4048e5x

Additional Information

https://techdocs.broadcom.com/us/en/ca-enterprise-software/it-operations-management/spectrum/21-2/programming/web-services-api-reference.html