SOLVED

Not getting PostgreSQL Logs into Log Analytics

Brass Contributor

According to this guide:

https://docs.microsoft.com/en-gb/azure/postgresql/concepts-server-logs

 

You do the following to enable the logs to be ingested to Log Analytics:

  1. In the portal, go to Diagnostic Settings in the navigation menu of your Postgres server.
  2. Select Add Diagnostic Setting.
  3. Name this setting.
  4. Select your preferred endpoint (storage account, event hub, log analytics).
  5. Select the log type PostgreSQLLogs.
  6. Save your setting.

 

I have no idea where the option 'select log type' is ? This never seems to be present.

Ignoring that though, after you have done the above (including ticking every possible option for logging) then it should be a case of running AzureDiagnostics and seeing the log files come flowing in.

Trouble is, I get nothing, I've tried it in a couple of environments and both have the same problem.

Surely I should get something ?

1 Reply
best response confirmed by JK_UK (Brass Contributor)
Solution

Hi@JK_UK 

 

One thing to make sure which you probably did is that you need the instance to be General Purpose or Memory Optimized SKU.

 

In the blade of the PostgreSQL instance you should have Logs option on the left menu. That logs option allows you to query Log Analytics directly and any query you enter will automatically be scoped only to the logs that are generated by the PostgreSQL instance of the blade.

 

With diagnostic logs you have to keep in mind that these become available in AzureDiagnostics table only when such log is generated. If such log is not generated you might see the table empty for your PostrgeSQL instance until log is generated. In case you are logging only errors and warnings you might want to set the minimum log level on the PostgreSQL instance so you generate more log levels.

1 best response

Accepted Solutions
best response confirmed by JK_UK (Brass Contributor)
Solution

Hi@JK_UK 

 

One thing to make sure which you probably did is that you need the instance to be General Purpose or Memory Optimized SKU.

 

In the blade of the PostgreSQL instance you should have Logs option on the left menu. That logs option allows you to query Log Analytics directly and any query you enter will automatically be scoped only to the logs that are generated by the PostgreSQL instance of the blade.

 

With diagnostic logs you have to keep in mind that these become available in AzureDiagnostics table only when such log is generated. If such log is not generated you might see the table empty for your PostrgeSQL instance until log is generated. In case you are logging only errors and warnings you might want to set the minimum log level on the PostgreSQL instance so you generate more log levels.

View solution in original post