question

SabirLaskar-6219 avatar image
0 Votes"
SabirLaskar-6219 asked OuryBa-MSFT commented

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

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-postgresql
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @SabirLaskar-6219 Welcome to Microsoft Q&A and Thank you for posting your question.
We are looking into this issue and will contact you shortly. Thanks

0 Votes 0 ·

1 Answer

OuryBa-MSFT avatar image
0 Votes"
OuryBa-MSFT answered OuryBa-MSFT commented

Hello @SabirLaskar-6219
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 Docs.
Please let us know if that helps. Thanks



image.png (21.6 KiB)
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @SabirLaskar-6219 Please let us know if you have further query. If the answer is helpful please accept it so it can be beneficial for other community members facing the same. Thanks

1 Vote 1 ·