APIM manage workflow with multiple roles APIM 3.0.0 per API based subscription workflow Logging internal HTTP requests Log APIM analytics events to a file Monetization and sample with WSO2 API Manager 2.6.0 Share application and subscription among a set of specific groups or roles WSO2 APIM Correlating analytics event with correlationID APIM analytics distinguish production and sandbox traffic APIM 2.x.x analytics internal and analytics tuneup Configure APIM(Next release) Key Manager User stores APIM(Next release) working with key manager DAS 3.x Parse system variables to Spark Context Revoke OAuth application In APIM 2.1.0 Next WSO2 APIM powered by WSO2 Ballerina Configure WSO2 APIM Analytics on Cluster environment Configure WSO2 DAS 3.1.0 for WSO2 APIM 2.0.0 Analytics WSO2 APIM publishing custom statistics WSO2 APIM Error codes Working with WSO2 message tracer Use DAS admin service to query using Spark SQL Configure WSO2 APIM Analytics using XML WSO2 APIM Generating and Retrieving Custom Statistics Understanding WSO2 APIM Statistics Model Publishing WSO2 APIM 1.10.x Runtime Statistics to DAS with RDBMS Publishing_APIM_1100_Runtime_Statistics_to_DAS Aggregate functions with WSO2 DAS REST API Create a cApp for WSO2 DAS Debugging WSO2 Products using OSGI console. Publishing APIM Runtime Statistics to DAS Deploy cApp on WSO2 DAS How to configure and start the Accumulo minicluster How to setup DNS server on Ubuntu and Ubuntu server How to use Java Reflection how to install apache web server on ubuntu and ubuntu server How to install Mail server on Ubuntu and Ubuntu server How to install squirrelmail webmail client on Ubuntu and Ubuntu Server Pass and return String value to JNI method Pass and return numeric value to JNI method Calling a C Function from the Java Programming Language using JNI AXIS 2 Sample web service Client with maven and eclipse How to setup AXIS 2 with Apache Tomcat AXIS 2 Sample web service with maven and eclipse Robot framework Sample with Selenium Robot framework Custom Library Sample Behaviour-Driven Development with JBehave and Eclipse Play Audio with Netbeans and linking with LibVLC Implement LibVLC based player with QT-part2 Simple Audio playing sample with LibVLC How to install LibVLC on Ubuntu Implement LibVLC based player with QT-part1
Logging internal HTTP requests
  • In WSO2 products there are multiple HTTP/SOAP requests are happens. As an example, APIM uses AuthenticationAdmin to authenticate a user. Such cases, it may be a crucial requirement for logging request data for troubleshooting. For such cases debug logging can be enabled for the following packages.

    ex: Enabling debug logs for APIM 3.0.0

  • Open and add the followings to the <APIM_HOME>/repository/conf/log4j2.properties
    loggers = ..., HTTP_CONTENT, HTTP_HEADER
    
    logger.HTTP_CONTENT.name = httpclient.wire.content
    logger.HTTP_CONTENT.level = DEBUG
    
    logger.HTTP_HEADER.name = httpclient.wire.header
    logger.HTTP_HEADER.level = DEBUG
    
    
  • Logs can be seen as below if you try to login to /admin portal. In that case, wire and header details will be logged according to the AuthenticationAdmin service.x
    [2019-12-13 14:48:59,983] DEBUG - header >> "POST /services/AuthenticationAdmin HTTP/1.1[\r][\n]"
    [2019-12-13 14:48:59,984] DEBUG - header >> "SOAPAction: urn:login[\r][\n]"
    [2019-12-13 14:48:59,985] DEBUG - header >> "Content-Type: application/soap+xml[\r][\n]"
    [2019-12-13 14:48:59,985] DEBUG - header >> "User-Agent: Jakarta Commons-HttpClient/3.1[\r][\n]"
    [2019-12-13 14:48:59,986] DEBUG - header >> "Host: localhost:9443[\r][\n]"
    [2019-12-13 14:48:59,986] DEBUG - header >> "Content-Length: 324[\r][\n]"
    [2019-12-13 14:48:59,986] DEBUG - header >> "[\r][\n]"
    [2019-12-13 14:48:59,987] DEBUG - content >> "<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:aut="http://authentication.services.core.carbon.wso2.org"><soap:Header/><soap:Body><aut:login><aut:username>admin</aut:username><aut:password>admin</aut:password><aut:remoteAddress>localhost</aut:remoteAddress></aut:login></soap:Body></soap:Envelope>"
    [2019-12-13 14:49:00,035]  INFO - CarbonAuthenticationUtil 'admin@carbon.super [-1234]' logged in at [2019-12-13 14:49:00,035+0530]
    [2019-12-13 14:49:00,037] DEBUG - header << "HTTP/1.1 200 [\r][\n]"
    [2019-12-13 14:49:00,037] DEBUG - header << "HTTP/1.1 200 [\r][\n]"
    [2019-12-13 14:49:00,037] DEBUG - header << "X-Content-Type-Options: nosniff[\r][\n]"
    [2019-12-13 14:49:00,038] DEBUG - header << "X-XSS-Protection: 1; mode=block[\r][\n]"
    [2019-12-13 14:49:00,038] DEBUG - header << "X-Frame-Options: DENY[\r][\n]"
    [2019-12-13 14:49:00,038] DEBUG - header << "Set-Cookie: JSESSIONID=F0BC9A03E4633CAB4379DEBF8D4CC222; Path=/; Secure; HttpOnly[\r][\n]"
    [2019-12-13 14:49:00,039] DEBUG - header << "Content-Type: application/soap+xml; action="urn:loginResponse";charset=UTF-8[\r][\n]"
    [2019-12-13 14:49:00,039] DEBUG - header << "Transfer-Encoding: chunked[\r][\n]"
    [2019-12-13 14:49:00,039] DEBUG - header << "Date: Fri, 13 Dec 2019 09:19:00 GMT[\r][\n]"
    [2019-12-13 14:49:00,039] DEBUG - header << "Server: WSO2 Carbon Server[\r][\n]"
    [2019-12-13 14:49:00,040] DEBUG - header << "[\r][\n]"
    [2019-12-13 14:49:00,040] DEBUG - content << "1"
    [2019-12-13 14:49:00,040] DEBUG - content << "1"
    [2019-12-13 14:49:00,041] DEBUG - content << "f"
    [2019-12-13 14:49:00,041] DEBUG - content << "[\r]"
    [2019-12-13 14:49:00,041] DEBUG - content << "[\n]"
    [2019-12-13 14:49:00,041] DEBUG - content << "<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><ns:loginResponse xmlns:ns="http://authentication.services.core.carbon.wso2.org"><ns:return>true</ns:return></ns:loginResponse></soapenv:Body></soapenv:Envelope>"
    [2019-12-13 14:49:00,042] DEBUG - content << "[\r]"
    [2019-12-13 14:49:00,042] DEBUG - content << "[\n]"
    [2019-12-13 14:49:00,042] DEBUG - content << "0"
    [2019-12-13 14:49:00,042] DEBUG - content << "[\r]"
    [2019-12-13 14:49:00,043] DEBUG - content << "[\n]"
    [2019-12-13 14:49:00,043] DEBUG - content << "[\r]"
    [2019-12-13 14:49:00,043] DEBUG - content << "[\n]"
    [2019-12-13 14:49:00,043] DEBUG - header << "[\r][\n]"
    

Add Comment

* Required information
1000
Powered by Commentics

Comments (0)

No comments yet. Be the first!