Log Laravel API calls to AWS Cloudwatch - laravel-8

I have been using this package (https://github.com/maxbanton/cwh) to setup logging in my laravel 8 app.
I can already send the logs properly and see them in Cloudwatch and what I am trying to do is to log the API calls (request and response). I was able to do this by doing it by adding it in the middleware. My only question is that how can you do this asynchronously? I have found this discussion posted as an issue and this was the suggested solution (https://github.com/maxbanton/cwh/issues/25#) but I couldn't figure out how to implement it.
Has anybody able to send API logs to Cloudwatch asynchronously? Thank you.

What you can try is sent the call to a queued job or listener (beanstalkd preferably as using DB as storage will probably take the same time as sending the log to AWS) that is not running on the sync queue.
This way you can fire the call off to something else, and that can deal with it without you waiting for it.

Related

How to know if the deployment on Netlify is done via API?

I successfully deployed a site from my web app using Netlify API, but I don’t know how to get the info that if the deployment is done or not.
I thought the response from get-deploy can be the answer, especially the summary.status of that response.
I tried to keep calling the /api/v1/sites/:site_id/deploys/:deploy_id endpoint every 5 sec and watching summary.status, however, the value of summary.status has never changed from building even after the deployment has been done.
How can I get this kind of data?
Thank you.
Calling the /api/v1/sites/:site_id/deploys/:deploy_id endpoint is the right way to do it, they say.

SAP Cloud SDK JS receives empty data from Enterprise Messaging Queue

I have build a simple cloud-SDK based application for adding as a Webhook in Enterprise messaging queue to receive the events as soon as it gets inside the queue.
I have an OPTIONS and POST function. OPTIONS is for the handshake with the queue and it works.
Now, when there is message in the Queue, it hits my application with the POST block but the request body is coming as empty object.
I have tried the same from the postman, i'm able to receive the data in request body. Only from the Enterprise messaging queue, the data is empty.
In contrast, to verify this, I have used a Express based nodejs application, there i'm able to receive the data from the queue.
What am i missing in the Cloud-SDK based code ?
POST block, looks like this
#Post('ems-events')
receiveEmsEvents(#Body() requestBody: string, #Req() req:Request) {
Logger.log("Event Received with Data:");
Logger.log(requestBody);
Logger.log(req.body);
Logger.log("Log over--");
Logger.log(Object.keys(req));
return {};
}
The SAP Cloud SDK for JavaScript does not offer any support for Enterprise Messaging as of today. The code you're writing here is most likely Nest.js code, which is an independent framework.
That being said, Nest.js does run Express.js under the hood by default. So if you've been able to make it work in Express, you should be able to make it work in Nest.

Spinnaker github webhook does not trigger pipeline

I have followed the guide for github pipeline triggers via webhooks and while I can verify that the webhook was sent successfully with the exact filepath artifact, my pipeline is not triggered.
I have verified the artifact expected is sent and the response is 200 from github with body:
{"eventId":"5a05b1b0-ac9f-4222-bdeb-caa1a7f4b216","eventProcessed":true}
I have checked the echo log and there doesn't seem to be anything but startup information. It must not be logging webhooks and responses, or else I figured I would see the ^^eventId I received on the github side.
Here is a gist with this information including the payload.
Below is an image of the pipeline config - at this time I'm just trying to trigger it and get a slack notification, but nothing is triggered:
What am I missing here? How can I debug further?
I found the error thanks to Pere on the spinnaker slack channel.
I have the spinnaker trigger watching master (which is what I want for production), and I was commit/pushing test files to develop. So while the webhook is configured to push for any case, it is filtering it on the spinnaker side. Changing the trigger to watch develop worked.
As a side note, neither successful nor unsuccessful triggers showed in the echo log.

How to receive webhook signal from 3rd party service

I'm using a SaaS for my AWS instance monitoring and Mandrill for email sending/campaigns.
I had created a simple chart with Zapier but I'd rather like to host it myself. So my question is:
How can I receive a webhook signal from Mandrill and then send it to Datadog from my server? Then again I guess hosting this script right on the same server I'm monitoring would be a terrible idea...
Basically I don't know how to "receive the webhook" so I can report it back to my Datadog service agent so it gets updated on their website.
I get how to actually report the data to Datadog as explained here http://docs.datadoghq.com/api/ but I just don't have a clue how to host a listener for web hooks?
Programming language isn't important, I don't have a preference for that case.
Here you can find how to add a new webhook to your mandrill account: https://mandrillapp.com/api/docs/webhooks.php.html#method=add
tha main thing here is this:
$url = 'http://example/webhook-url';
this is your webhook URL what will process the data sent by mandrill and forward the information to Datadog.
and this is a description about what mandrill will send to your webhook URL: http://help.mandrill.com/entries/21738186-Introduction-to-Webhooks
a listener for webhooks is nothing else then a website/app which triggers an action if a request comes in. Usually you keep it secret or secure it with (http basic) authentication. E.g. create a website called http://yourdomain.com/hooklistener.php. You can then call it with HTTP POST or GET and pass some data like hooklistener.php?event=triggerDataDog or with POST and send data along with the body. You then run a script or anything you want to process that event.
A "listener" is just any URL that you host where you can receive data that is posted to it. Keep in mind, since you mentioned Zapier, you can set up a trigger that receives the webhook data - in this case the listener URL is provided by Zapier, and you can then send that data into any application (or even post to another webhook). Using Zapier is nice because it doesn't require you to write the listener code that receives the hook data and does something with it.

Want to know little info about enabling Asynchronous Request Processing in Apache Server?

I'm working upon Paypal integration for our website. As we know, we will provide IPN URL for every orders processing through Paypal, Last week, I have given a server URL for the Paypal Notification and also using that, I have processed the payments.
But, today, when i shifted my projects into an another server, where i have implemented the same IPN system. But I dont get the Notification for the same URL, in my new server. It seems that my new apache server doesn't support Asynchronous Request Processing.
What can i do to make my server to process Asynchronous Requests. Anyone please let me know, how can i do it?
Thanks in advance.
The "asynchronous" in the word doesn't refer to a feature that has to be activated in Apache. It's just that PayPal sends the request whenever it's ready, and your script calling it has no way of telling when that is.
Most likely, the server move changed something in the server URL. Try out some of the requests that you are telling PayPal to do manually and see what happens and what errors you get.