Sending logs to Azure Monitor from Python is not working anymore

Giancarlo 45 Reputation points
2024-10-29T13:25:14.9933333+00:00

Is there something happening with Azure Monitor? I know opencensus-ext-azure was deprecated last month.

pip install azure-monitor-opentelemetry==1.6.2


from logging import INFO, getLogger

from azure.monitor.opentelemetry import configure_azure_monitor

configure_azure_monitor(

    connection_string="my-connection-string",

    logger_name="azure_monitor",

)

logger = getLogger("azure_monitor")

logger.setLevel(INFO)

logger.info("test")



Retrying due to server request error: 
Azure Monitor
Azure Monitor
An Azure service that is used to collect, analyze, and act on telemetry data from Azure and on-premises environments.
3,472 questions
{count} vote

Accepted answer
  1. Pranay Reddy Madireddy 2,075 Reputation points Microsoft Vendor
    2024-11-11T22:04:57.94+00:00

    Hi Giancarlo

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    Check your application can connect to Azure Monitor without problems.

    Check that the credentials have the right permissions to send data to Azure Monitor. A 403-error means access is denied.
    https://learn.microsoft.com/sr-cyrl-rs/azure/azure-monitor/logs/api/errors

    Check that your connection string is correct and valid.

    Ensure the Azure resource you're sending data to has the right permissions, and that your connection string is linked to a valid Azure Monitor or Application Insights resource.

    If you are using an agent (like the Azure Monitor Agent), check its status and logs for errors that could show connection issues with Azure services.
    https://learn.microsoft.com/en-us/azure/azure-monitor/agents/agent-windows-troubleshoot?tabs=UpdateMMA
    https://learn.microsoft.com/en-us/azure/azure-monitor/agents/azure-monitor-agent-troubleshoot-windows-vm

    If you have any further queries, do let us know.


    If the answer is helpful, please click "Accept Answer" and "Upvote it".


1 additional answer

Sort by: Most helpful
  1. Ekaterina Tcareva (LinkedIn Supplier) 0 Reputation points Microsoft Employee
    2024-11-23T22:10:11.36+00:00

    Hello, I have the same problem... when I use
    configure_azure_monitor with logger_name="my name here" the logs are not sending to azure. Without logger_name parameter it works as expected

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.