Questions
Find answers to frequently asked development questions. For information about Better Stack products, explore our docs.
How To Whitelist Better Uptime IPs in UFW
Learn how to whitelist Better Uptime IPs on UFW and prevent any false incident alerting.
How To Whitelist Better Uptime IPs in Digital Ocean
Learn how to whitelist Better Uptime IPs on Digital Ocean and prevent any false incident alerting.
How To Whitelist Better Uptime IPs and User Agent in Cloudflare
Learn how to whitelist Better Uptime IPs on Cloudflare and prevent any false incident alerting.
How To Whitelist Better Uptime IPs on Azure
Learn how to whitelist Better Uptime IPs on Microsoft Azure and prevent any false incident alerting.
How To Write Logs To A File With Python?
Using Basic Configuration You can use basic config. If you configure the attribute filename, logs will be automatically saved to the file you specify. You can also configure the attribute ...
How To Use Logging In Multiple Modules?
It's recommended to have a logger defined in each module like this: import logging logger = logging.getLogger(name) Then in your main program, do the following: import logging.config logging.config...
How To Log Uncaught Exceptions In Python?
For this, you can use the sys.excepthook that allows us to attach a handler for any unhandled exception: Creating a logger logger = logging.getLogger(name) logging.basicConfig(filename='e...
How to Log to Stdout with Python?
Using Basic Configuration Python, by default, logs to a console. You can call the function on the module: import logging logging.warning("Warning.") OUTPUT WARNING:root:Warning. Python already prov...
How to log data as JSON with Python
How to Log Data As JSON With Python? The simplest way is to use a custom module.
How To Log All Requests From The Python Request Library?
You need to use urllib3 logger and set the log level to DEBUG: log = logging.getLogger('urllib3') log.setLevel(logging.DEBUG) To maximise the message you can get, set HTTPConnec...
How To Disable Logging While Running Django Unit Tests?
By Disabling Tests At The Start Of The Application Suppose you want to do it the quick way. In that case, the following line of code will disable any log messages less severe or equal to CRITI...
How To Disable Logging From The Python Request Library?
You can change the log level of the logger taking care of these messages. Setting the level to WARNING will remove the request messages and keep warnings and errors: import logging loggin...
How To Color Python Logging Output?
Without External Module Create a new custom formatter: class CustomFormatter(logging.Formatter): then create variables for the colors. They are created as ASCII code for an escape character followe...
Where can I find MySQL logs in phpMyAdmin?
In the older version of the phpMyAdmin control panel, there is Binary log in which all logs are stored. This can be opened by clicking Status → Binary log In newer versions, the Status page looks l...
Where can I find error log files for PHP?
PHP stores error logs in /var/log/apache2 if PHP is an apache2 module. Shared hosts are often storing log files in your root directory /log subdirectory. If you are using cPanel...
Where are PostgreSQL logs stored?
PostgreSQL stores logs in the log files. Depending on your system, you can find the logs at the following locations: Ubuntu On Ubuntu and Ubuntu-like systems, the PostgreSQL log is stored in the /v...
Where are PHP logs stored?
PHP stores error logs in /var/log/apache2 if PHP is an apache2 module. Shared hosts are often storing log files in your root directory /log subdirectory. If you are using cPanel...
Where are MySQL logs stored?
The official distributions for individual UNIX/Linux platforms are typically script-based, with little or no interactive configuration during installation. Some installation packages (including Yum...
MySQL/Writing file error (Errcode 28)
If you have received an MySQL error with the error code and don’t know what the code means, you can use the perror command to display the text explanation of the error code. perror 28 Output: OS er...
Log all queries in MySQL
In MySQL, it is possible to log all queries that were executed. You can view them as a table or file. Output query history into a table To output executed queries into a table, run the following My...
How to show the last queries executed on MySQL?
In MySQL, it is possible to show the last queries that were executed. You can view them as a table or file. Output query history into a table To output executed queries into a table, run the follow...
How to log PostgreSQL queries?
If you would like to log all PostgreSQL queries into a file, you can do that by changing few settings int the configuration file Open the data/postgresql.conf file and change the following settings...
How to Get the Query Executed in Laravel 5
By default, the query log is disabled in Laravel 5: Don’t worry, you can enable the query log by running the following: // enable query log DB::enableQueryLog(); Then you can display the log like t...
How to enable MySQL Query Log?
MySQL query log stores the history of executed queries. This history is stored in a log file. On busy servers, this file ca grow very large. To enable the query log, put the following line into&nbs...
How to do error logging in CodeIgniter (PHP)
Code igniter has logging capabilities built-in. Make sure you do the following: Make your /application/logs folder writable In /application/config/config.php set the following: ...
Reading syslog output on a Mac
Same as Linux, MacOS saves system logs into a syslog file. This location of the syslog is /var/log/system.log. On newer MacOS versions, you will find the log at /private/var/log/system.log You can ...
Warning: Remote Host Identification Has Changed
What does it mean You may wonder what WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED error means. SSH connection uses keys, files stored on the computer, to authenticate the server and the client....
How to Start Docker Containers Automatically After a Reboot?
Docker provides restart policies to control whether your containers start automatically when they exit, or when Docker restarts. Restart policies ensure that linked containers are started...
How to ping Docker container from another container by name?
The feather of accessing or pinging containers from other containers using their name rather than their IP address comes out of the box with docker networks. For this, you will need two (or more) c...
How to pass environment variables to a Docker container?
It is always a good practice to separate the app from its configuration. It is not a good idea to have a database login credential defined as variables in the code of the application. This is why w...
How to fix docker: Got permission denied while trying to connect to the Docker daemon socket
This error may appear when running docker commands and it is caused by insufficient privilages. Solution To resolve the problem, you need to do the following: Create a docker group sudo groupadd do...
How do I disable ipv6 on Ubuntu 20.04
To disable IPv6 on your Ubuntu 20.04 system, open the /etc/sysctl.conf file in your favorite text editor and put the following lines at the end of the file: net.ipv6.conf.all.disableipv6 = 1 net.ip...
Error Permission denied (publickey) when I try to ssh
This error appears when trying to SSH into a server. The publickey in the brackets after the error message is misleading. One reason might be wrong configuration in sshd_config file and the second ...
502 bad gateway Nginx
If you are getting the 502 bad gateway error when accessing a Nginx server, here are a few solutions: Check if Nginx is running To check if Nginx is running run the following command: systemctl sta...
Where does Linux store my syslog?
Linux has a special directory for storing logs. This directory contains collected logs from the operating system itself, services and other applications running on the system. The actual location d...
Where can I find the IIS log?
You can find your IIS log file in the following directory: %SystemDrive%\inetpub\logs\LogFiles If the directory doesn’t exist in your system, try looking in the following directory %SystemDrive%\Wi...
Where can I find the error logs of NGINX, using FastCGI and Django?
By default Nginx stores its error logs in the /var/log/nginx/error.log file and access logs in the /var/log/nginx/access.log. To change the location of the log files, configure the following direct...
Understanding access log columns in Nginx
The NGINX logs the activities of all the visitors to your site in the access logs. Here you can find which files are accessed, how NGINX responded to a request, what browser a client is using, IP a...
Reading syslog output on a Mac
Same as Linux, MacOS saves system logs into a syslog file. This location of the syslog is /var/log/system.log. On newer MacOS versions, you will find the log at /private/var/log/system.log You can ...
Log.INFO vs. Log.DEBUG
When logging, logged messages are differentiated by their importance. In most logging frameworks we differentiate the following levels of importance: DEBUG - Lowest level. Fine-grained statements c...
Log analyzer tools for IIS web server logs
IIS webserver logs each and every access into a log file. To better understand the data from the log, little help is needed in the form of a log analyzer. Log analyzer is a software that allows you...
How to view syslog in Ubuntu?
Linux has a special directory for storing logs. This directory contains collected logs from the operating system itself, services and other applications running on the system. The actual location d...
How to view log output using docker-compose run?
You can start Docker compose in detached mode and attach yourself to the logs of all containers later. If you're done watching logs you can detach yourself from the logs output witho...
How to run cron jobs every 5, 10, or 30 seconds?
By default, cron checks crontabs for cronjobs every minute. If you want to run a job every n seconds you need to use a simple workaround.
How to access Redis log file?
As many other services, Redis stores its log in the special log file. The location of the Redis log depends on the type of the installation. With a default apt-get installation on Ubuntu ...
How To Whitelist Better Uptime IPs on Google Cloud Platform
Learn how to whitelist Better Uptime IPs on Google Cloud and prevent any false incident alerting.
How To Whitelist Better Uptime IPs on AWS
Learn how to whitelist Better Uptime IPs on AWS and prevent any false incident alerting.
Where to keep SSL certificates and private keys on Ubuntu and Debian?
To list all available CA SSL certificates run the following lines of code:
Where Are Docker Images Stored on the Host Machine?
If you want to have a quick look at where is Docker storing your Docker images, you can use the docker info command: docker info Output: ... Storage Driver: Docker Root Dir: /var/lib/docker ... ...
Should I Use Vagrant or Docker for Creating an Isolated Environment?
This depends on what exactly you want to do. The short answer would be that if you want to manage virtual machines, you want to use Vagrant. If you want to build and run an application environment,...