Eurofiber-CloudInfra / azure-url-monitor

Slightly more advanced version of the URL monitor tool of Azure that stores the results in Application Insights
Apache License 2.0
1 stars 0 forks source link

Get VMSS Container logs into Log Analytics #32

Open DennisR73 opened 2 years ago

DennisR73 commented 2 years ago

When deployed as a VMSS, there is currently no configuration to centrally view the container logs. Would be helpful to have those logs in the Log Analytics Workspace.

DennisR73 commented 2 years ago

possible option is to deploy the omsagent container as part of the deployment. It does however generate lots of additional metric/inventory data so probably need to be tweaked. Preferably should only store logs in ContainerLogv2 format.

services:
  azure_url_monitor:
    container_name: azure-url-monitor
    environment:
      AI_INSTRUMENTATION_KEY: cf82400a-b547-47e6-97b6-a45d3196050d
      CERTIFICATE_CHECK_EXPIRATION: "TRUE"
      CERTIFICATE_EXPIRATION_GRACETIME_DAYS: '14'
      CERTIFICATE_IGNORE_SELF_SIGNED: "FALSE"
      CERTIFICATE_VALIDATION_CHECK: "TRUE"
      LOCATION: virtual machine scale set
      NM_TIMEOUT_COLLECTION: '300000'
      NM_TIMEOUT_REQUEST: '5000'
      NM_TIMEOUT_SCRIPT: '5000'
      PM_COLLECTION_URL: https://www.getpostman.com/collections/e911b0e57becdf131593
      TEST_FREQUENCY_MINUTES: '2'
    extra_hosts:
      otherhost.example.com: 10.2.2.2
      somehost.example.com: 10.1.1.1
    image: ghcr.io/eurofiber-cloudinfra/azure-url-monitor:74
    network_mode: host
    restart: unless-stopped
  omsagent:
    environment:
      KEY:  xxxxxxxxxxxxxxx
      WSID: 01360873-f7aa-4e42-b166-a52470835fe3
    image: mcr.microsoft.com/azuremonitor/containerinsights/ciprod:microsoft-oms-latest
    privileged: true
    restart: on-failure
    volumes:
    - /var/run/docker.sock:/var/run/docker.sock:rw
    - /var/lib/docker/containers:/var/lib/docker/containers:rw