How to configure Laravel 5.1 to log to syslog? - laravel

I am using 5.1 version of Laravel with PHP 5.6. From Laravel website, I gather that it will be possible to log to syslog via their monolog library. But I can't find any examples on how to do that. Can you please tell me how to log to syslog from Laravel? I tried setting the APP_LOG=syslog in .env file. That causes Laravel to stop logging to file but it does not log anything to syslog. How do I specify syslog server ip:port or socket address?

According to the documentation, you should use this in config/app.php:
'log' => 'syslog'
Log Modes
Out of the box, Laravel supports single, daily, syslog and errorlog
logging modes. For example, if you wish to use daily log files instead
of a single file, you should simply set the log value in your
config/app.php configuration file.

It says in the docs to set the log value in your config file config/app.php to syslog:
'log' => 'syslog'
https://laravel.com/docs/5.1/errors#configuration

Related

System cannot open daily log file automatically in laravel

I am developing a laravel application. I am facing the laravel daily log file problem. I updated 'channels' => ['daily'] instead of 'channels' => ['single'] in the channels an array of config/logging.php file. When I login in application's live server, the new date laravel log file can not open automatically. So I am always setting this command "sudo chmod -R 777 /var/www/html/storage/logs" when I login in live server. Why can not access the new date log file automatically? Could you please help me? Thanks.

Laravel on AWS: APP_DEBUG not respected

I initially deployed my Laravel app with APP_DEBUG set to true, but now we're in production I don't want it to whoops! every time there's an error.
I've changed the contents of our EB .config file so that APP_DEBUG: false and I can see the change in Elastic Beanstalk's environment properties:
But Laravel itself is still dumping everything to the screen when there's an error.
I've tried ssh-ing into our server and running php artisan config:clear to see if it was that, but it still didn't work.
I don't understand why Laravel isn't respecting the updated configuration on deployment. Can anyone explain the logic here?
Update: I updated the security settings on the instance and noticed that it was giving our custom error screen. Can anyone explain what happened? Was restarting the server after running php artisan config:clear what did it?
I had issues like this before where I changed something in the console's environment properties which did not correspont with what I got using tinker. You can find the env file on your instance here:
/opt/elasticbeanstalk/deployment/env
if you open the file you see that variables set in .env are not quoted so if you have a password with for example a hashtag or a name with spaces it can result in unintended problems.
I would suggest to stop using environment variables via .yaml config files and start deploying your .env to the elastic beanstalk S3 bucket and fetching it on deployment. This will result in you having more control over the content of the file.
Example of this can be found here:
https://github.com/rennokki/laravel-aws-eb/blob/master/.ebextensions/00_copy_env_file.config

Where is Laravel.log on GAE google cloud platform?

I deployed my laravel application on GCP App Engine
https://MY-PROJECT-NAME.appspot.com/
"Whoops, looks like something went wrong." is displayed.
I want to check a error log. but I couldn't find laravel.log.
Where can I see the log file.
According to the community documentation, you can specify the log-file in your app.yaml file as follows:
env_variables:
# Put production environment variables here.
APP_LOG: errorlog
Regarding the error message, it seems that you may be able to solve it by updating your installer and project with:
composer global update
composer update
You can find more information about that here
The laravel log will be inside your storage directory
storage/logs/laravel.log

Laravel - .env vs database.php

I am confused by Laravels .env file VS other settings
I have a .env file which has my sql database settings inside, but I also have a file in config/database.php that has these settings inside.
When I deploy my application to an Elastic Beanstalk instance, which of these files is it using for the database settings?
.env is short for environment and thus that is your environment configurations.
The database.php configuration contains non-critical information.
You obviously won't have your database's username's password in your source control or available in the code.
In order to keep everything safe or to keep information saved that is environment-defined... you keep them in .env file
Laravel will prioritize .env variables.
A little more detailed answer:
The config Files are where you store all configurations. You shouldn't add any username, passwords or other secret informations in them, because they will be in your source control.
All secret informations and all environment dependant informations should be stored in your .env file. With this you can have different configuration values in local/testing/production with just a different .env file.
In your config files you access the information in you .env files, if necessary.
When use what from another answer
use env() only in config files
use App::environment() for checking the environment (APP_ENV in .env).
use config('app.var') for all other env variables, ex. config('app.debug')
create own config files for your own ENV variables. Example:
In your .env:
MY_VALUE=foo
example config app/myconfig.php
return [
'myvalue' => env('MY_VALUE', 'bar'), // 'bar' is default if MY_VALUE is missing in .env
];
Access in your code:
config('myconfig.myvalue') // will result in 'foo'
In your ".env" file you have your settings. in the ".php" files like your "database.php" file this is the default value for the property and normally, the corresponding value in the ".env" file is use here with this syntax : 'database' => env('database', 'default_value'),
The .env file is the first file it will use for configs. In case values are missing inside the .env file Laravel will check the config files. I primairly use those as backups.

Change the web access log location for SonarQube?

Is it possible to change the web access log location for SonarQube (version 5.6.2) ?
I think we can enable/disable the web access logging and change the log pattern using the sonar.properties file but I couldn't find a way to change the access log filename. Actually all I want is to send the access logs to stdout in my SonarQube docker container.
Came across a mention of a sonar.path.logs property on: http://www.jouvinio.net/wiki/index.php/Configuration_Logs_SonarQube
Added this option to conf/sonar.properties and it worked successfully after sonar restart.
sonar.path.logs=/var/log/sonarqube
[root#azsu-s-bi01sq1 failover]# ls -a /var/log/sonarqube/
. .. access.log ce.log es.log sonar.log web.log

Resources