Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
787 stars 142 forks source link

[Enhancement]: Log file sink #2252

Open JerryNixon opened 3 weeks ago

JerryNixon commented 3 weeks ago

Today, we support a sink to Application Insights:

{
    "telemetry": {
        "application-insights": {
            "enabled": true,
            ...
        }
    }
}

Proposing a file sink for local storage. This is particularly relevant for customers who do not have Application Insights as an option and want more than just Console output.

{
    "telemetry": {
        "application-insights": {
            "enabled": true,
            ...
        },
        "local-file": {
            "enabled": true,
            "file-path": "/path/to/logfile.log",
            "max-file-size": 10485760, // 10 MB in bytes
            "max-backup-files": 5,
            "rollover-interval": "daily" // options: 'daily', 'weekly', 'monthly'
        }
    }
}

Properties:

  1. enabled: (Boolean) Enables or disables the local file logging.
  2. file-path: (String) Specifies the path to the log file.
  3. max-file-size: (Integer) The maximum size of the log file in bytes before it rolls over.
  4. max-backup-files: (Integer) The maximum number of backup files to retain.
  5. rollover-interval: (String) Defines how often the log file should roll over (e.g., daily, weekly, monthly).

Related: https://github.com/serilog/serilog-settings-configuration