API Log Management using Push Model

Not applicable

Hi, I'm trying to configure the node.js setup from the following link to see the activity in Loggly in my account.

https://community.apigee.com/articles/3352/api-log-management-push-model.html

I wanted to attach my sample proxy "tutorial-loggly-api-proxy" from my org. But unfortunately size exceeds the actual size to be uploaded.

My sample proxy deployed successfully but it always giving errors as follows.

Ex: http://swapnaadusu07-test.apigee.net/tutorial-loggly-api-proxy

Error:

{"fault":{"faultstring":"Classification failed for host swapnaadusu07-test.apigee.net","detail":{"code":"CLASSIFICATION_FAILED"}}}

and also I'm not able to find any logs in my Loggly account. Attached screen print.

Can anyone please help me to fix this and able to see the logs in Loggly?

Thanks!

Solved Solved
0 11 209
1 ACCEPTED SOLUTION

Not applicable

Hi @Swapna. I'm able to replicate this issue. There was an error in the codebase, which I just fixed here. I've also pushed a new version to your org and it should be working fine:

$ curl http://swapnaadusu07-test.apigee.net/tutorial-loggly-api-proxy/pets\?error\=code_raised
{"message":"Woops! Looks like something broke!","type":"ERROR-0001","messageid":"rrt18apigee_BTtiBoqA_RouterProxy-2-528214_1"}

Also, yes, you can leverage other loggers such as: Winston-Logstash instead of Loggly.

Hope it helps!

View solution in original post

11 REPLIES 11

Not applicable

It appears that the URL you are accessing is incorrect. I can't see your org, if you invite me I would be happy to take a look at the proxy.

ok Thanks @David Allen. Please share your email ID to add into my org. Thanks!

dallen - at- apigee.com

@David Allen, Can we use the Logstash instead of Loggly? If yes, what are steps to confure the Logstash in my app to log the log messages. Thanks!

Not applicable

Hi @Swapna. Agree with David. It looks like as if your API endpoint is not correct or it wasn't deployed correctly. Can you please verify the URL and redeploy again? I tried adding /pets, but no luck. Please share access with me as well.

curl http://swapnaadusu07-test.apigee.net/tutorial-loggly-api-proxy/pets?error=code_raised

ok Thanks @Diego Zuluaga. Please share your email ID to add into my org. Thanks!

Here it is. dzuluaga@apigee.com

Added you into my org. Please let me know once you find the issue. Thanks!

@Diego Zuluaga and @David Allen, I have tried by modifying the base path of proxy and it looks like working in session trace and able to see the logs in Node.js Logs in Edge but I'm not able to see the logs in loggly. If I'm accessing the pets by using the below URL's then it is giving different error.

URL's:

http://swapnaadusu07-test.apigee.net/tutorial-loggly-api-proxy/pets?error=code_raised http://swapnaadusu07-test.apigee.net/tutorial-loggly-api-proxy/pets?erro r=reference

Error:

TypeError: Cannot call method "error" of undefined at /organization/environment/api/app.js:21 at next (/node_modules/express/node_modules/connect/lib/proto.js:188) at pass (/node_modules/express/lib/router/index.js:110) at nextRoute (/node_modules/express/lib/router/index.js:100) at callbacks (/node_modules/express/lib/router/index.js:167) at callbacks (/node_modules/express/lib/router/index.js:161) at param (/node_modules/express/lib/router/index.js:131) at pass (/node_modules/express/lib/router/index.js:145) at nextRoute (/node_modules/express/lib/router/index.js:100) at callbacks (/node_modules/express/lib/router/index.js:167) at callbacks (/node_modules/express/lib/router/index.js:161) at callbacks (/node_modules/express/lib/router/index.js:170) at param (/node_modules/express/lib/router/index.js:138) at pass (/node_modules/express/lib/router/index.js:145) at /node_modules/express/lib/router/index.js:90 at router (/node_modules/express/lib/router/index.js:33) at next (/node_modules/express/node_modules/connect/lib/proto.js:193) at expressInit (/organization/environment/api/node_modules/express/lib/middleware.js:30) at next (/node_modules/express/node_modules/connect/lib/proto.js:193) at query (/node_modules/express/node_modules/connect/lib/middleware/query.js:45) at next (/node_modules/express/node_modules/connect/lib/proto.js:193) at /node_modules/express/node_modules/connect/lib/proto.js:201 at app (/node_modules/express/node_modules/connect/lib/connect.js:65) at emit (events.js:98) at adaptorhttp.js:488 at domain.js:183 at domain.js:123 at adaptorhttp.js:487 at adaptorhttp.js:576

Attached the screen print of Loggly.

I have one more question, I have few proxies already configured into my application API's. But I would need to configure this project (node.js) into already existing proxies to log the messages into the Loggly tool.

Please help me on fixing this. Thanks!

Not applicable

Hi @Swapna. I'm able to replicate this issue. There was an error in the codebase, which I just fixed here. I've also pushed a new version to your org and it should be working fine:

$ curl http://swapnaadusu07-test.apigee.net/tutorial-loggly-api-proxy/pets\?error\=code_raised
{"message":"Woops! Looks like something broke!","type":"ERROR-0001","messageid":"rrt18apigee_BTtiBoqA_RouterProxy-2-528214_1"}

Also, yes, you can leverage other loggers such as: Winston-Logstash instead of Loggly.

Hope it helps!

Thanks @Diego Zuluaga It worked fine. But not able to see log details in my loggly account. I have downloaded the new copy project from GIT and did the steps in the mentioned in the above link. But deployment errors and not able to trace the calls. Can you please have a look and let me know did I missed anything?

I have a requirement to send the log messages to logstash server. I knew that I need to provide the server IP and port number in MessageLogging policy. I will provide it. But what my question, how apigee can send logs directly to logstash? Do I need to configure anything else? Thanks!