fo you are using a managed Kubernetes service, like GKE or EKS, you will need to make sure that your nodes are running a supported container runtime before Docker support is removed re-apply or update your custom configurations if you use any. If you are running Kubernetes on-premise, you should also need to make changes to avoid unwanted problems and surprises.
WARN: denotes less-harmful events than errors. Usually, they do not lead to any degradation of capabilities or complete failure of the application. However, they are still red flags and must be investigated.
TRACE: denotes most low-level information like stack traces of code to provide the most information on a certain event/context. These logs help us inspect the variable values and full error stacks.
Make sure you avoid logging information like business names, related personnel (employees, clients, suppliers, etc.), and business and personal contact information. Logs should never expose the business relationships and related party transactions to outsiders. To trace back specific transactions, instead of using real business names and identifiers, make sure you use an event ID generated by the system and pass it through the other services.
Revealing threats and vulnerabilities with the help of application runtime and log messages is an art that every enterprise software developer must learn. In general, security breaches and catastrophic failures in applications do not happen suddenly. Most of the time, there are some clues that no one notices in the first place. Therefore we must always log suspicious human activities (e.g., failed authentication and verification attempts with all low-level information like networks used, request origins, and user roles and privileges attached) as well as the system behaviours (e.g., increasing of spikes in resource consumption patterns, high loads on web servers, services getting choked randomly). When a suspicious event is noticed, make sure the logs capture all information related to it, ideally a full-stack trace including parameter values and additional information available from the application context.
By law, all financial data must be fully hidden/masked in the logs. Exposing such information in logs can easily result in serious lawsuits (can be even interpreted as criminal offences). Therefore, avoid such cases at all times.
Diligence is a great characteristic of computing devices, but they may not be as perfect as we were taught at school. Performance anomalies or sudden unexpected degradations in services (mostly due to unhandled errors and corrupted data) can happen at any given time. To identify them, it is always recommended to publish stats on overall system health and performance. Such stats may include information like API calls counts (both successfully served ones and a separate failure count), network latencies, average roundtrip times, memory consumption, and other application-specific information (mostly decided by the business context).
This Displayed duration does not necessarily include everything your app needs to do before it’s ready to go. You can supply that extra information to the system by calling Activity.reportFullyDrawn() whenever your app determines it’s completely done loading and initializing. If/when you call that optional method, the system issues another log with that timestamp and duration:
Security credentials and auth tokens are considered sensitive information, and making them exposed via logs help intruders carry out easy security breaches in the system. Therefore, always be mindful of such sensitive information and keep it away from the logs.
It has long been suggested the line that separates genius from insanity is fine indeed. For this reason, only one thing distinguishes the “genius” from the madman, and that one thing is a word called — SUCCESS.
Almost all the privacy laws (e.g., GDPR, CCPA) clearly advise developers to keep PII away from the logs. PII includes information like first name, last name, username, gender, birthday, mailing and billing addresses, emails, phone numbers, social security numbers (SSN), and credit card numbers.
As I wrote before in an earlier (and unfortunately outdated and incorrect) blog, there’s a handy log that the system has been issuing since the KitKat release. Whenever an activity starts, you’ll see something like this in the logcat output:
This duration (1,380ms in this example) represents the time that it took from launching the app to the time when the system consider it “launched,” which includes drawing the first frame (hence “Displayed”).
System events must capture information on behaviour events (startups, stops, restarts, security events), changeover modes (cold, warm, hot), inter-service communication (handshakes, connection building statuses — connect, disconnect, reconnect, retry events), service instance IDs, actively serving APIs, actively listening IP and port ranges, configurations loaded (initial load up and dynamic updates), overall service health, and anything that helps to understand the behaviour of the system.
Note: Specifying what information to hide from logs will be easy if you can attach an attribute to each field specifying its visibility level (e.g., show, mask, hide, encrypt). If you have such a mechanism, you can enable and disable the visibility of fields just by updating a property in configurations. If you have a requirement for logging some of the user data in non-production environments, especially for testing and debugging purposes, this is the way to go. Alternatively, you can write parsers to filter the log messages and handle the sensitive fields according to the pre-defined instructions based on the environment.