Application Logging

Recommendation

Scope of the recommendation: Application Logging
Out of Scope: IIS Logging, Auditing
Definition: An application log is a file of events that are recorded by a software application. It contains errors, informational events and warnings. The format and content of an application log are determined by the developer of the software program, rather than the operating system.
Usage: Logging/Recording application events to accommodate trouble shooting, provide health status (for the application) or preventing an issue from becoming a larger problem.
Alternative use: Alerting technical groups of specific event when it occurs.

Top 5 Best Practices

What to log

Debug logs typically report application events that are useful when diagnosing a problem. Investigations into application failures need the “W” words: Who, What, When, Where and Why:

Suggested Log Types

How to log

Avoid implementing any in-house logging mechanism. Existing library are very mature and offer a wide range of granularities and configuration options. We recommend the use of existing Logging libraries

When to Log

In all verticals using appropriate log levels based on the analysis needs

Where to send log data

At the moment there is no setup available to send our logs. We think that this could be a very good initiative for IITB.

The relational databases are not the best place to send log data. Time-series databases (TSDB) are much more efficient at storing log data. Open-source TSDB such as InfluxDB are much better suited to storing log data than relational databases.

The ELK stack is a popular solution for log aggregation. ELK is an acronym that stands for Elasticsearch, Logstash, and Kibana.
Elasticsearch is a fast search engine that is used to find data in large datasets.
Logstash is a data pipeline platform that will collect log data from many sources and feed it to a single persistence target.
Kibana is a web-based data visualizer and search engine that integrates with Elasticsearch.

Log File Location

The following locations are set by SADE and are the departments standard

  E:\\WebLogs\[SADE-Vertical]\[application abbreviation]\[application sub folders if required]
 E:\\WebLogs\\[application abbreviation]\[application sub folders if required]

Note from SADE: “If the log directory structure does not exist as stated above, the application should take the initiative to create it (on the fly). Understanding that the directory name and structure should be defined in the Web.Config”

Log File Content

File name

Ex: APP_NAME_20190930_MLWB200.log

Content Data will be determined by the requirement and need. We recommend including the following data elements for each log record:

Sensitive content

How do you access the logs?

For apps hosted in Intranet, use Shared Folders to the log file location set by SADE.
For apps hosted in OPS or DMZ (Internet), the accessibility of the log files is on request only. 2 options exist: