how to access and read archived postgresql logs from blob storage ?

Sabir Laskar 21 Reputation points
2021-04-29T05:13:06.2+00:00

We have made diagnostic settings in one of our azure postgresql server to archive postgresql logs into the storage account.

But when we exploring the storage using storage explorer is showing into muliple folder hirearachy like y=2021/m=4/h=24/m=01/PT1H.json

Multiple such file for every minutes.

How to make them as text readable logs as we see in server logs section?

Azure Database for PostgreSQL
{count} votes

Accepted answer
  1. Oury Ba-MSFT 17,061 Reputation points Microsoft Employee
    2021-04-30T22:18:49.883+00:00

    Hello @Sabir Laskar
    According to documentation there should only be one log per hour Azure resource logs - Azure Monitor
    Send resource logs to Azure storage to retain it for archiving. Once you have created the diagnostic setting, a storage container is created in the storage account as soon as an event occurs in one of the enabled log categories. The blobs within the container use the following naming convention:
    Each PT1H.json blob contains a JSON blob of events that occurred within the hour specified in the blob URL (for example, h=12). During the present hour, events are appended to the PT1H.json file as they occur. The minute value (m=00) is always 00, since resource log events are broken into individual blobs per hour.
    Note
      
Platform logs are written to blob storage using JSON lines, where each event is a line and the newline character indicates a new event. This format was implemented in November 2018. Prior to this date, logs were written to blob storage as a JSON array of records as described in Prepare for format change to Azure Monitor platform logs archived to a storage account.
    You can have the logs sent to log analytics instead of azure storage. From there you can query them like described here. Logs - Azure Database for PostgreSQL - Single Server | Microsoft Learn.
    Please let us know if that helps. Thanks


0 additional answers

Sort by: Most helpful