Disable Heroku Router Logs - heroku

I've written a Heroku app, that's a very simple API. A number of GET requests are made to it with sensitive information amongst their parameters. It would be preferable to have Heroku not log this sensitive information.
Is there any way to have Heroku not log requests or better yet, truncate the path so it contains no parameters?

I don't think there's a way to do it. The usual answer is to POST the sensitive information rather than use GET, but I'm guessing that's not an option for you.

Using heroku logs --source app will only show the logs of you app.
heroku logging

I had the same issue and as I didn't find a solution.
So I'll let you know my workaround for PHP Laravel 6.3 application on Heroku.
Activate Papertrail addon (free with "Wayne" plan)
Show web app output
Filter for "application" (and environment, in my case "staging"
"Save search" -> Replace existing search -> "web app output"
Hope this helps others.

In case anyone is still searching for this. Papertrail now supports Log filters.
Just go to Papertrail > Dashboard > lower right corner > Filter logs.
You can use a regular expression like this:
heroku\/router
and papertrail will ignore all heroku/router logs. This however does not prevent Heroku from emitting those logs altogether, you can still see live heroku/router logs by going to your app's dashboard and clicking "More"> "View Logs.
It can significantly reduce costs though.

Related

Heroku not applying environment variable changes in Okta OAuth 2.0 PKCE VueJs app

I' trying to execute the OAuth 2.0 PKCE demo with a VueJs app outlined here:
https://developer.okta.com/blog/2019/08/22/okta-authjs-pkce
https://github.com/oktadeveloper/okta-auth-js-pkce-example
Once in the Heroku App I have these Environment Variables:
Everything appears to be running fine except for the fact that the variables OKTA_CLIENT_ORGURL and OKTA_OAUTH2_ISSUER were refering to an incorrect dev-XXXXXX address, the correct one is the one shown on the picture (dev-371167), before it was someone else's url (dev-739491) for some reason.
The problem is that after making the changes shown in the image to the correct dev url, it's still making the calls to the old dev-739491 url.
Heroku doesn't seem to be refreshing or making the desired changes in the app.
Am I missing an option to refresh? Is it possible to rebuild so it reads the new changes? Could the problem be in the code/build itself?
Thanks.
EDIT: As per the suggestion in the comment I turned the app off then on again and it still didn't make the changes.
This is what my screen looks like:
EDIT 2: I have since deployed the same app two more times and reading the build logs it assigns a random CLIENT_ID and URls. Each deployed app has a different pair of these. I don't know where they come from.
I wrote the Okta Heroku Add-On. I'm looking into the behavior you're seeing.
When you change the environment variables, heroku should restart your app automatically.
So, the two issues are that the environment variables didn't match you saw in Heroku didn't match with what you expected them to be and that the app doesn't seem to be picking up on the environment variables.
How did you know that dev-371167 was the correct org and that dev-739491 was incorrect?
When you say you deployed the app two more times, what exactly are you doing to deploy? Are you using the Heroku cli?

how to debug during API with laravel

I run my laravel app #localhost.
```php artisan serve --host=localhostIP```
On top I run an Andoid app with the same base URL.
Could anyone tell me how can I debug incoming API´s calls
like if BASEURL/users is called?
Furthermore, how can I log the happening events in the console
I am developing API's with laravel too, i do it this way:
composer require laravel/homestead to have it all in a vm 😉 see https://laravel.com/docs/master/homestead for more information, i use the "per project" installation
Download postman to have the best tool for sending querys to your api and to test your api quick -> https://www.getpostman.com (i use it free)
configure and run your homestead (it's not that complicated).
your homestead is fit with php and xdebug enabled
i am using phpStorm and have my vagrant setup as deployment target
"listen to debug" with phpstorm
to your GET requests, add a queryparam XDEBUG_SESSION_START=PHPSTORM
i can debug my api now 😉
i also wrote https://logcrawler.de to receive the log informations of all my api's and all my server 🤩
I hope, i could help you a little bit
This is my way, but I think it's not good!
Create router api in config/web, Eg:
router/api: Route::post('/check_api', [CheckController::class, 'testFunc'])->name('api.check_api');
web/api: Route::post('test/check_api', [CheckController::class, 'testFunc'])->name('test.check_api');
Create a post by form or ajax in one resource/view like index
Go to page, and debug with phpstorm
You can use logging feature of Laravel. Apply Logs on entry point of application to test whether API url is hitting or not.
use postman
https://www.getpostman.com/downloads/
it's an excellent thing very much usefull

How to get stack trace in google actions logs, because 'final_response' must be set is useless

The debugging in actions on google is hell. The only usefull thing to do is if you debug in Dialogflow test console, because there you can see exactly where it went wrong. But here you just get this MalformedResponse: 'final_response' must be set. Is there any way to print out console.log so you can see at least in Logs Viewer what went through and what didn't?
Because from this, you can't see anything what went wrong except that conv.ask didn't execute or am i missing something?
insertId: "id"
labels: {
channel: "preview"
querystream: "GOOGLE_USER"
source: "JSON_RESPONSE_VALIDATION"
}
logName: "projects/0/logs/actions.googleapis.com%2Factions"
receiveTimestamp: "2018-08-27T08:01:46.632208192Z"
resource: {
labels: {
action_id: "actions.intent.TEXT"
project_id: "avant2goassistant"
version_id: ""
}
type: "assistant_action"
}
severity: "ERROR"
textPayload: "MalformedResponse: 'final_response' must be set"
timestamp: "2018-08-27T08:01:46.605934393Z"
trace: "projects/0/traces/0"
There are a lot of places to investigate if you get this error.
First check the obvious - that your Intent has fulfillment enabled. At the bottom of your Intent, make sure "Enable webhook call for this intent" is turned on.
If you're sure about that, check the logs for your webhook. You haven't specified how or where your webhook is running, so I can't provide detailed guidance on that, but if you're using the Dialogflow built in editor, you can check out the logs in Firebase. Make sure there isn't an error being thrown.
I often run testing locally (using firebase serve --only functions) and use ngrok to provide a secure tunnel. ngrok also provides a protocol inspector which will let you look at the response you're sending back to Dialogflow.
If you're still having issues, you may wish to turn on Dialogflow logging to Google Cloud. This is on the settings screen (under the gear icon for your project) and towards the bottom. It is off by default - turn it on, and you can follow the link there to see where the logs are. This will show you what is sent to your fulfillment and what you get back.
Much of this information is also in the "Response" and "Debug" tabs in the Actions on Google simulator. You can also look there (or post them on StackOverflow) if you still need help.
Using the Dialogflow simulator isn't sufficient for debugging Actions - the AoG environment sends additional information that the Dialogflow simulator doesn't.

How to debug a Firefox search engine plugin?

I am writing a search engine plugin for Firefox.
I want to implement search suggestions, so I want my plugin to send requests to my server to get them.
In order to debug this functionality I need to see what requests have been sent and what response is returned.
I noticed that Firebug does not log this info. So I need something else. How can I do that?
The add-on LiveHTTPHeaders works.
https://addons.mozilla.org/en-US/firefox/addon/live-http-headers/
Also try Ctrl+Shift+Q and look at the Network tab, that will probably work, too, although I haven't used that before.
Tools-->Web Developer--->Browser Console(Ctrl+Shift+J)
And in the tab of Net, check "Log Request and Response Bodies"

Heroku error logs without heroku command

How can I check the error logs of Heroku,
without running:
heroku logs
Since I'm using Codeship.io, I can't use 'heroku' commands
There is a free heroku add on, Papertrail.
And this to your heroku app (can be done command line or via the heroku UI)
then on your Resources tab you can click Papertrail.
Helpfull note with Papertaril, you can set up email notifications on string comparisons. This can help for early fault detection.
If you have access to the heroku app you could view the logs from there:
(open the app page then press the dotted more button on the top right then press view logs)
(requires you to keep the logs page open)
logs one
logs two
or set up a webhook
(open the app page then press the dotted more button on the top right then press view webhooks and once the page has loaded click create webhook then set-up your webhook)
(i use it with discord: Ohttps://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks)
(may not have an error option)
webhooks one
webhooks two
webhooks three
or like gregmcpugh said you could use the add on papertrail. (which i also use)
There is a free heroku add on, Papertrail.
And this to your heroku app (can be done command line or via the heroku UI) then on your Resources tab you can click Papertrail.
Helpful note with Papertrail, you can set up email notifications on string comparisons. This can help for early fault detection.
(no bad thing i can say about this one!)
papertrail one
papertrail two
papertrail three
damn people being before me :P
hope i helped! :D

Resources