Log Analytics Webspace against ContainerInstanceLogs has no entry Container IP

Waqar Ahmad 0 Reputation points
2024-11-20T13:14:20.29+00:00

Can anyone suggest, issue i am facing is that i need to set an alert that if my container restarts, it should retain the assigned IP, otherwise it should send an alert. However to enable such alert, I am unable to find my ContainerInstanceLog containing the information about private IP of ACI.

My ContainerInstanceLog is renamed after logs of Instance has been redirected to the Log Analytics Analyzer

Can someone assist?

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,396 questions
Azure Container Instances
Azure Container Instances
An Azure service that provides customers with a serverless container experience.
716 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Sina Salam 14,551 Reputation points
    2024-11-20T17:25:46.83+00:00

    Hello Waqar Ahmad,

    Welcome to the Microsoft Q&A and thank you for posting your questions here.

    I understand that you are having issues finding your private IP Address: Log Analytics Webspace against ContainerInstanceLogs has no entry Container IP.

    To find the private IP address of your Azure Container Instance (ACI) and set up an alert for IP changes upon restart, you can use the Azure CLI and Azure portal. First, open Azure Cloud Shell from the Azure portal by clicking on the Cloud Shell icon at the top of the page. Then, run the following command to retrieve the private IP address of your container instance:

    az container show --name <your-container-name> --resource-group <your-resource-group> --query ipAddress.ip --output tsv
    
    

    Replace <your-container-name> and <your-resource-group> with the actual names of your container and resource group. This command will output the private IP address of your container instance.

    The NEXT, to set up an alert for your ACI to notify you if the IP changes upon restart, follow these steps:

    1. Create an Alert Rule for Container Restart:
    • Go to the Azure portal and navigate to your container instance.
    • Select Alerts from the container blade.
    • Click on Create Alert Rule.
    • Under the Scope section, ensure your container instance is selected.
    • Click Add Condition and select the Restart Container Group signal.
    • Click Done.
    1. Add Action Groups:
    • Under Actions, click Add Action Groups.
    • Select the subscription and resource group.
    • Configure the notification settings (e.g., email, SMS) and click Next: Notifications.
    • Review and create the alert rule.
    1. Use Azure Log Analytics to monitor the IP address. Ensure your container logs are being sent to Log Analytics and create a query in Log Analytics to check the IP address of your container instance:
         ContainerInstanceLog
         | where TimeGenerated > ago(1h)
         | project TimeGenerated, IPAddress
    

    Set up an alert based on this query to notify you if the IP address changes.

    1. If you need a static IP for your container instance, consider deploying your ACI in a virtual network and using a static IP configuration. This can be done by setting up a user-defined route and using Azure Firewall or NAT gateway.

    I hope this is helpful! Do not hesitate to let me know if you have any other questions.


    Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.


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.