Membuat kueri log Manajemen Pembaruan

Selain detail yang disediakan selama penyebaran Manajemen Pembaruan, Anda dapat mencari log yang disimpan di ruang kerja Analitik Log Anda. Untuk mencari log dari akun Otomatisasi Anda, pilih Manajemen pembaruan dan buka ruang kerja Analitik Log yang terkait dengan penyebaran Anda.

Anda juga dapat menyesuaikan kueri log atau menggunakannya dari klien yang berbeda. Lihat Dokumentasi API pencarian Analitik Log.

Membuat kueri catatan pembaruan

Manajemen Pembaruan mengumpulkan catatan untuk VM Windows dan Linux dan jenis data yang muncul di hasil pencarian log. Bagian berikut menjelaskan catatan tersebut.

Membuat kueri catatan Pembaruan

Catatan dengan jenis Update dibuat yang mewakili pembaruan yang tersedia dan status penginstalannya untuk mesin. Rekaman ini memiliki properti dalam tabel berikut:

Properti Deskripsi
TenantId Pengidentifikasi unik yang mewakili instans ID Microsoft Entra organisasi Anda.
SourceSystem Sistem sumber untuk catatan. Nilainya adalah OperationsManager.
TimeGenerated Tanggal dan waktu pembuatan catatan.
SourceComputerId Pengidentifikasi unik yang mewakili komputer sumber.
Judul Judul pembaruan.
Klasifikasi Klasifikasi persetujuan. Nilainya adalah Pembaruan.
PublishedDate (UTC) Tanggal pembaruan siap diunduh dan diinstal dari Windows Update.
Komputer Nama domain mesin pelaporan yang sepenuhnya memenuhi syarat.
UpdateState Status pembaruan saat ini.
Produk Produk yang pembaruannya berlaku.
OSType Jenis sistem operasi. Nilainya adalah Windows atau Linux.
ProductVersion Versi pembaruan.
Lengkungan Produk Arsitektur mesin yang berlaku
CVENumbers Nomor Kerentanan dan Paparan Umum
BuletinUrl URL Buletin
BuletinID Nomor ID buletin.
PackageRepository Info repositori paket.
PackageSeverity Tingkat keparahan pembaruan.
OSName Jenis sistem operasi. Nilainya adalah Windows atau Linux.
OSVersion Versi sistem operasi.
OSFullName Nama sistem operasi.
SubscriptionId Pengidentifikasi unik untuk langganan Azure.
ResourceGroup Nama grup sumber daya tempat sumber daya berada.
ResourceProvider Penyedia sumber daya.
Sumber daya Nama sumber daya.
ResourceId Pengidentifikasi unik untuk sumber daya yang terkait dengan catatan.
ResourceType Jenis sumber daya
ComputerEnvironment Lingkungan. Nilai yang mungkin adalah Azure atau Non-Azure.
VMUUID Pengidentifikasi unik untuk komputer virtual.
MG Pengidentifikasi unik untuk grup manajemen atau ruang kerja Analitik Log.
ManagementGroupName Nama grup manajemen Manajer Operasi atau ruang kerja Analitik Log.
MSRCSeverity Tingkat keparahan untuk kerentanan. Nilainya adalah:
Kritis
Penting
Sedang
Kurang Penting
KBID ID artikel pangkalan pengetahuan terkait pembaruan Windows.
UpdateID Pengidentifikasi unik pembaruan perangkat lunak.
RevisionNumber Nomor revisi dari revisi tertentu pembaruan.
Opsional Benar jika catatan bersifat opsional, atau Salah jika bersifat wajib.
RebootBehavior Perilaku reboot setelah menginstal/menghapus instalan pembaruan.
MSRCBulletinID Nomor ID buletin keamanan.
disetujui Benar jika catatan disetujui, atau Salah jika ditolak.
ApprovalSource Berlaku hanya untuk sistem operasi Windows. Sumber persetujuan untuk catatan. Nilainya adalah Microsoft Update.
InstallTimePredictionSeconds
InstallTimeDeviationRangeSeconds
InstallTimeAvailable
Jenis Jenis data. Nilainya adalah Perbarui.

Catatan Status Penyebaran Pembaruan Kueri

Catatan dengan jenis UpdateRunProgress dibuat yang menyediakan status penyebaran pembaruan dari penyebaran terjadwal dengan komputer. Rekaman ini memiliki properti dalam tabel berikut:

Properti Deskripsi
TenantId Pengidentifikasi unik yang mewakili instans ID Microsoft Entra organisasi Anda.
SourceSystem Sistem sumber untuk catatan. Nilainya adalah OperationsManager.
TimeGenerated Tanggal dan waktu pembuatan catatan.
MG Pengidentifikasi unik untuk grup manajemen atau ruang kerja Analitik Log.
ManagementGroupName Nama grup manajemen Manajer Operasi atau ruang kerja Analitik Log.
SourceComputerId Pengidentifikasi unik yang mewakili komputer sumber.
KBID ID artikel pangkalan pengetahuan terkait pembaruan Windows.
UpdateId Pengidentifikasi unik pembaruan perangkat lunak.
SucceededOnRetry Nilai yang menunjukkan jika eksekusi pembaruan gagal pada upaya pertama dan operasi saat ini adalah upaya coba lagi.
ErrorResult Kode galat Windows Update dibuat jika pembaruan gagal diinstal.
UpdateRunName Nama jadwal pembaruan.
InstallationStatus Kemungkinan status penginstalan pembaruan di komputer klien,
NotStarted - pekerjaan belum dipicu.
Failed - pekerjaan dimulai tapi gagal dengan pengecualian.
InProgress - pekerjaan dalam proses.
MaintenanceWindowExceeded - jika eksekusi tersisa tetapi interval jendela pemeliharaan tercapai.
Succeeded - pekerjaan berhasil.
Install Failed - pembaruan gagal diinstal.
NotIncluded - klasifikasi pembaruan yang sesuai tidak cocok dengan entri pelanggan dalam daftar klasifikasi input.
Excluded - pengguna memasukkan KBID dalam daftar yang dikecualikan. Saat melakukan patching, jika KBID dalam daftar yang dikecualikan cocok dengan ID KB pembaruan yang terdeteksi sistem, itu ditandai sebagai dikecualikan.
Komputer Nama domain mesin pelaporan yang sepenuhnya memenuhi syarat.
Judul Judul pembaruan.
Produk Produk yang pembaruannya berlaku.
OSType Jenis sistem operasi. Nilainya adalah Windows atau Linux.
Waktu Mulai (UTC) Waktu ketika pembaruan dijadwalkan untuk diinstal. Properti ini saat ini tidak digunakan. Lihat TimeGenerated.
EndTime (UTC) Waktu ketika proses sinkronisasi berakhir. Properti ini saat ini tidak digunakan. Lihat TimeGenerated.
CorrelationId Pengidentifikasi unik dari pekerjaan runbook yang dijalankan untuk pembaruan.
SubscriptionId Pengidentifikasi unik untuk langganan Azure.
ResourceGroup Nama grup sumber daya tempat sumber daya berada.
ResourceProvider Penyedia sumber daya.
Sumber daya Nama sumber daya.
ResourceId Pengidentifikasi unik untuk sumber daya yang terkait dengan catatan.
ResourceType Jenis sumber daya.
ComputerEnvironment Lingkungan. Nilainya adalah Azure atau Non-Azure.
VMUUID Pengidentifikasi unik untuk komputer virtual.
Jenis Jenis pembaruan. Nilainya adalah UpdateRunProgress.
_ResourceId Pengidentifikasi unik untuk sumber daya yang terkait dengan catatan.

Catatan Ringkasan Pembaruan Kueri

Catatan dengan jenis UpdateSummary dibuat yang menyediakan ringkasan pembaruan dengan komputer. Rekaman ini memiliki properti dalam tabel berikut:

Properti Deskripsi
TenantId Pengidentifikasi unik yang mewakili instans ID Microsoft Entra organisasi Anda.
SourceSystem Sistem sumber untuk catatan. Nilainya adalah OpsManager.
TimeGenerated Tanggal dan waktu pembuatan catatan.
MG Pengidentifikasi unik untuk grup manajemen atau ruang kerja Analitik Log.
ManagementGroupName Nama grup manajemen Manajer Operasi atau ruang kerja Analitik Log.
SourceComputerId Pengidentifikasi unik untuk komputer virtual.
LastUpdateApplied (UTC)
OldestMissingSecurityUpdateInDays Jumlah total hari untuk pembaruan terlama yang terdeteksi sebagai berlaku yang belum diinstal.
OldestMissingSecurityUpdateBucket Penentu bucket keamanan terlama yang hilang. Nilainya adalah:
Terbaru jika nilainya kurang dari 30 hari
30 hari yang lalu
60 hari yang lalu
90 hari yang lalu
120 hari yang lalu
150 hari yang lalu
180 hari yang lalu
Lebih lama jika nilainya lebih besar dari 180 hari.
WindowsUpdateSetting Status agen Windows Update. Kemungkinan nilai adalah:
Scheduled installation
Notify before installation
Error returned from unhealthy WUA agent
WindowsUpdateAgentVersion Version agen Windows Update.
WSUSServer Kesalahan jika agen Windows Update memiliki masalah, untuk membantu pemecahan masalah.
Komputer Nama domain mesin pelaporan yang sepenuhnya memenuhi syarat.
OsVersion Versi sistem operasi.
NETRuntimeVersion Versi .NET Framework yang terinstal di komputer Windows.
CriticalUpdatesMissing Jumlah pembaruan penting berlaku yang tidak ada.
SecurityUpdatesMissing Jumlah penambal keamanan hilang yang berlaku.
OtherUpdatesMissing Jumlah pembaruan yang terdeteksi hilang.
TotalUpdatesMissing Jumlah total pembaruan hilang yang berlaku.
RestartPending Benar jika hidupkan ulang tertunda, atau Salah jika sebaliknya.
SubscriptionId Pengidentifikasi unik untuk langganan Azure.
ResourceGroup Nama grup sumber daya yang berisi sumber daya.
ResourceProvider Penyedia sumber daya.
Sumber daya Nama sumber daya untuk catatan.
ResourceId Pengidentifikasi unik untuk sumber daya yang terkait dengan catatan.
ResourceType Jenis sumber daya.
ComputerEnvironment Lingkungan. Nilainya adalah Azure atau Non-Azure.
VMUUID Pengidentifikasi unik untuk komputer virtual.
Jenis Jenis data. Nilainya adalah UpdateSummary.
_ResourceId Pengidentifikasi unik untuk sumber daya yang terkait dengan catatan.

Contoh kueri

Bagian berikut ini menyediakan sampel kueri log untuk catatan pembaruan yang dikumpulkan untuk Manajemen Pembaruan.

Mengonfirmasi komputer non-Azure diaktifkan untuk Manajemen Pembaruan

Untuk mengonfirmasi bahwa komputer yang terhubung langsung berkomunikasi dengan log Azure Monitor, jalankan salah satu pencarian log berikut.

Linux

Heartbeat
| where OSType == "Linux" | summarize arg_max(TimeGenerated, *) by SourceComputerId | top 500000 by Computer asc | render table

Windows

Heartbeat
| where OSType == "Windows" | summarize arg_max(TimeGenerated, *) by SourceComputerId | top 500000 by Computer asc | render table

Di komputer Windows, Anda dapat meninjau informasi berikut untuk memverifikasi konektivitas agen dengan log Azure Monitor:

  1. Di Panel Kontrol, buka Agen Pemantauan Microsoft. Pada tab Analitik Log Azure, agen menampilkan pesan berikut: Agen Pemantauan Microsoft berhasil terhubung ke Analitik Log.

  2. Buka Log Peristiwa Windows. Buka Log Aplikasi dan Layanan\Manajer Operasi dan cari ID Peristiwa 3000 dan ID Peristiwa 5002 dari sumber Konektor Layanan. Kejadian ini menunjukkan bahwa komputer telah terdaftar di ruang kerja Log Analytics dan sedang menerima konfigurasi.

Jika agen tidak dapat berkomunikasi dengan log Azure Monitor dan agen dikonfigurasi untuk berkomunikasi dengan internet melalui firewall atau server proxy, pastikan firewall atau server proxy dikonfigurasi dengan benar. Untuk mempelajari cara memverifikasi firewall atau server proxy dikonfigurasi dengan benar, lihat Konfigurasi jaringan untuk agen Windows atau Konfigurasi jaringan untuk agen Linux.

Catatan

Jika sistem Linux Anda dikonfigurasi untuk berkomunikasi dengan proxy atau Gateway Analitik Log dan Anda mengaktifkan Manajemen Pembaruan, perbarui izin proxy.conf untuk memberikan izin baca grup omiuser pada file dengan menggunakan perintah berikut:

sudo chown omsagent:omiusers /etc/opt/microsoft/omsagent/proxy.conf sudo chmod 644 /etc/opt/microsoft/omsagent/proxy.conf

Agen Linux yang baru ditambahkan menunjukkan status Diperbarui setelah penilaian dilakukan. Proses ini dapat memakan waktu hingga 6 jam.

Untuk mengonfirmasi bahwa grup manajemen Manajer Operasi sedang berkomunikasi dengan log Azure Monitor, lihat Memvalidasi integrasi Manajer Operasi dengan log Azure Monitor.

Kueri Penilaian VM Azure Tunggal (Windows)

Ganti nilai VMUUID dengan GUID VM dari komputer virtual yang Anda kueri. Anda dapat menemukan VMUUID yang harus digunakan dengan menjalankan kueri berikut ini di log Azure Monitor: Update | where Computer == "<machine name>" | summarize by Computer, VMUUID

Ringkasan pembaruan tidak ada

Update
| where TimeGenerated>ago(14h) and OSType!="Linux" and (Optional==false or Classification has "Critical" or Classification has "Security") and VMUUID=~"b08d5afa-1471-4b52-bd95-a44fea6e4ca8"
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Approved) by Computer, SourceComputerId, UpdateID
| where UpdateState=~"Needed" and Approved!=false
| summarize by UpdateID, Classification
| summarize allUpdatesCount=count(), criticalUpdatesCount=countif(Classification has "Critical"), securityUpdatesCount=countif(Classification has "Security"), otherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security")

Pembaruan yang tidak Ada

Update
| where TimeGenerated>ago(14h) and OSType!="Linux" and (Optional==false or Classification has "Critical" or Classification has "Security") and VMUUID=~"8bf1ccc6-b6d3-4a0b-a643-23f346dfdf82"
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Title, KBID, PublishedDate, Approved) by Computer, SourceComputerId, UpdateID
| where UpdateState=~"Needed" and Approved!=false
| project-away UpdateState, Approved, TimeGenerated
| summarize computersCount=dcount(SourceComputerId, 2), displayName=any(Title), publishedDate=min(PublishedDate), ClassificationWeight=max(iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1))) by id=strcat(UpdateID, "_", KBID), classification=Classification, InformationId=strcat("KB", KBID), InformationUrl=iff(isnotempty(KBID), strcat("https://support.microsoft.com/kb/", KBID), ""), osType=2
| sort by ClassificationWeight desc, computersCount desc, displayName asc
| extend informationLink=(iff(isnotempty(InformationId) and isnotempty(InformationUrl), toobject(strcat('{ "uri": "', InformationUrl, '", "text": "', InformationId, '", "target": "blank" }')), toobject('')))
| project-away ClassificationWeight, InformationId, InformationUrl

Kueri Penilaian VM Azure Tunggal (Linux)

Untuk beberapa distro Linux, ada ketidakcocokan endianness dengan nilai VMUUID yang berasal dari Azure Resource Manager dan apa yang disimpan dalam log Azure Monitor. Kueri berikut memeriksa kecocokan pada kedua endianness. Ganti nilai VMUUID dengan format big-endian dan little-endian GUID untuk menampilkan hasil dengan benar. Anda dapat menemukan VMUUID yang harus digunakan dengan menjalankan kueri berikut ini di log Azure Monitor: Update | where Computer == "<machine name>" | summarize by Computer, VMUUID

Ringkasan pembaruan tidak ada

Update
| where TimeGenerated>ago(5h) and OSType=="Linux" and (VMUUID=~"625686a0-6d08-4810-aae9-a089e68d4911" or VMUUID=~"a0865662-086d-1048-aae9-a089e68d4911")
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification) by Computer, SourceComputerId, Product, ProductArch
| where UpdateState=~"Needed"
| summarize by Product, ProductArch, Classification
| summarize allUpdatesCount=count(), criticalUpdatesCount=countif(Classification has "Critical"), securityUpdatesCount=countif(Classification has "Security"), otherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security")

Pembaruan yang tidak Ada

Update
| where TimeGenerated>ago(5h) and OSType=="Linux" and (VMUUID=~"625686a0-6d08-4810-aae9-a089e68d4911" or VMUUID=~"a0865662-086d-1048-aae9-a089e68d4911")
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, BulletinUrl, BulletinID) by Computer, SourceComputerId, Product, ProductArch
| where UpdateState=~"Needed"
| project-away UpdateState, TimeGenerated
| summarize computersCount=dcount(SourceComputerId, 2), ClassificationWeight=max(iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1))) by id=strcat(Product, "_", ProductArch), displayName=Product, productArch=ProductArch, classification=Classification, InformationId=BulletinID, InformationUrl=tostring(split(BulletinUrl, ";", 0)[0]), osType=1
| sort by ClassificationWeight desc, computersCount desc, displayName asc
| extend informationLink=(iff(isnotempty(InformationId) and isnotempty(InformationUrl), toobject(strcat('{ "uri": "', InformationUrl, '", "text": "', InformationId, '", "target": "blank" }')), toobject('')))
| project-away ClassificationWeight, InformationId, InformationUrl

Kueri penilaian multi-VM

Ringkasan komputer

Heartbeat
| where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId
| join kind=leftouter
(
    Update
    | where TimeGenerated>ago(14h) and OSType!="Linux"
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Approved, Optional, Classification) by SourceComputerId, UpdateID
    | distinct SourceComputerId, Classification, UpdateState, Approved, Optional
    | summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed" and (Optional==false or Classification has "Critical" or Classification has "Security") and Approved!=false, iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId
)
on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(WorstMissingUpdateSeverity, -1)
| summarize computersBySeverity=count() by WorstMissingUpdateSeverity
| union (Heartbeat
| where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId
| join kind=leftouter
(
    Update
    | where TimeGenerated>ago(5h) and OSType=="Linux"
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification) by SourceComputerId, Product, ProductArch
    | distinct SourceComputerId, Classification, UpdateState
    | summarize WorstMissingUpdateSeverity=max(iff(UpdateState=~"Needed", iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1)), 0)) by SourceComputerId
)
on SourceComputerId
| extend WorstMissingUpdateSeverity=coalesce(WorstMissingUpdateSeverity, -1)
| summarize computersBySeverity=count() by WorstMissingUpdateSeverity)
| summarize assessedComputersCount=sumif(computersBySeverity, WorstMissingUpdateSeverity>-1), notAssessedComputersCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==-1), computersNeedCriticalUpdatesCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==4), computersNeedSecurityUpdatesCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==2), computersNeedOtherUpdatesCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==1), upToDateComputersCount=sumif(computersBySeverity, WorstMissingUpdateSeverity==0)
| summarize assessedComputersCount=sum(assessedComputersCount), computersNeedCriticalUpdatesCount=sum(computersNeedCriticalUpdatesCount),  computersNeedSecurityUpdatesCount=sum(computersNeedSecurityUpdatesCount), computersNeedOtherUpdatesCount=sum(computersNeedOtherUpdatesCount), upToDateComputersCount=sum(upToDateComputersCount), notAssessedComputersCount=sum(notAssessedComputersCount)
| extend allComputersCount=assessedComputersCount+notAssessedComputersCount

Ringkasan pembaruan tidak ada

Update
| where TimeGenerated>ago(5h) and OSType=="Linux" and SourceComputerId in ((Heartbeat
| where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId))
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification) by Computer, SourceComputerId, Product, ProductArch
| where UpdateState=~"Needed"
| summarize by Product, ProductArch, Classification
| union (Update
| where TimeGenerated>ago(14h) and OSType!="Linux" and (Optional==false or Classification has "Critical" or Classification has "Security") and SourceComputerId in ((Heartbeat
| where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId))
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Approved) by Computer, SourceComputerId, UpdateID
| where UpdateState=~"Needed" and Approved!=false
| summarize by UpdateID, Classification )
| summarize allUpdatesCount=count(), criticalUpdatesCount=countif(Classification has "Critical"), securityUpdatesCount=countif(Classification has "Security"), otherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security")

Daftar komputer

Heartbeat
| where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions, Computer, ResourceId, ComputerEnvironment, VMUUID) by SourceComputerId
| where Solutions has "updates"
| extend vmuuId=VMUUID, azureResourceId=ResourceId, osType=1, environment=iff(ComputerEnvironment=~"Azure", 1, 2), scopedToUpdatesSolution=true, lastUpdateAgentSeenTime=""
| join kind=leftouter
(
    Update
    | where TimeGenerated>ago(5h) and OSType=="Linux" and SourceComputerId in ((Heartbeat
    | where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
    | summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
    | where Solutions has "updates"
    | distinct SourceComputerId))
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Product, Computer, ComputerEnvironment) by SourceComputerId, Product, ProductArch
    | summarize Computer=any(Computer), ComputerEnvironment=any(ComputerEnvironment), missingCriticalUpdatesCount=countif(Classification has "Critical" and UpdateState=~"Needed"), missingSecurityUpdatesCount=countif(Classification has "Security" and UpdateState=~"Needed"), missingOtherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security" and UpdateState=~"Needed"), lastAssessedTime=max(TimeGenerated), lastUpdateAgentSeenTime="" by SourceComputerId
    | extend compliance=iff(missingCriticalUpdatesCount > 0 or missingSecurityUpdatesCount > 0, 2, 1)
    | extend ComplianceOrder=iff(missingCriticalUpdatesCount > 0 or missingSecurityUpdatesCount > 0 or missingOtherUpdatesCount > 0, 1, 3)
)
on SourceComputerId
| project id=SourceComputerId, displayName=Computer, sourceComputerId=SourceComputerId, scopedToUpdatesSolution=true, missingCriticalUpdatesCount=coalesce(missingCriticalUpdatesCount, -1), missingSecurityUpdatesCount=coalesce(missingSecurityUpdatesCount, -1), missingOtherUpdatesCount=coalesce(missingOtherUpdatesCount, -1), compliance=coalesce(compliance, 4), lastAssessedTime, lastUpdateAgentSeenTime, osType=1, environment=iff(ComputerEnvironment=~"Azure", 1, 2), ComplianceOrder=coalesce(ComplianceOrder, 2)
| union(Heartbeat
| where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions, Computer, ResourceId, ComputerEnvironment, VMUUID) by SourceComputerId
| where Solutions has "updates"
| extend vmuuId=VMUUID, azureResourceId=ResourceId, osType=2, environment=iff(ComputerEnvironment=~"Azure", 1, 2), scopedToUpdatesSolution=true, lastUpdateAgentSeenTime=""
| join kind=leftouter
(
    Update
    | where TimeGenerated>ago(14h) and OSType!="Linux" and SourceComputerId in ((Heartbeat
    | where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
    | summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
    | where Solutions has "updates"
    | distinct SourceComputerId))
    | summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Title, Optional, Approved, Computer, ComputerEnvironment) by Computer, SourceComputerId, UpdateID
    | summarize Computer=any(Computer), ComputerEnvironment=any(ComputerEnvironment), missingCriticalUpdatesCount=countif(Classification has "Critical" and UpdateState=~"Needed" and Approved!=false), missingSecurityUpdatesCount=countif(Classification has "Security" and UpdateState=~"Needed" and Approved!=false), missingOtherUpdatesCount=countif(Classification !has "Critical" and Classification !has "Security" and UpdateState=~"Needed" and Optional==false and Approved!=false), lastAssessedTime=max(TimeGenerated), lastUpdateAgentSeenTime="" by SourceComputerId
    | extend compliance=iff(missingCriticalUpdatesCount > 0 or missingSecurityUpdatesCount > 0, 2, 1)
    | extend ComplianceOrder=iff(missingCriticalUpdatesCount > 0 or missingSecurityUpdatesCount > 0 or missingOtherUpdatesCount > 0, 1, 3)
)
on SourceComputerId
| project id=SourceComputerId, displayName=Computer, sourceComputerId=SourceComputerId, scopedToUpdatesSolution=true, missingCriticalUpdatesCount=coalesce(missingCriticalUpdatesCount, -1), missingSecurityUpdatesCount=coalesce(missingSecurityUpdatesCount, -1), missingOtherUpdatesCount=coalesce(missingOtherUpdatesCount, -1), compliance=coalesce(compliance, 4), lastAssessedTime, lastUpdateAgentSeenTime, osType=2, environment=iff(ComputerEnvironment=~"Azure", 1, 2), ComplianceOrder=coalesce(ComplianceOrder, 2) )
| order by ComplianceOrder asc, missingCriticalUpdatesCount desc, missingSecurityUpdatesCount desc, missingOtherUpdatesCount desc, displayName asc
| project-away ComplianceOrder

Pembaruan yang tidak Ada

Update
| where TimeGenerated>ago(5h) and OSType=="Linux" and SourceComputerId in ((Heartbeat
| where TimeGenerated>ago(12h) and OSType=="Linux" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId))
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, BulletinUrl, BulletinID) by SourceComputerId, Product, ProductArch
| where UpdateState=~"Needed"
| project-away UpdateState, TimeGenerated
| summarize computersCount=dcount(SourceComputerId, 2), ClassificationWeight=max(iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1))) by id=strcat(Product, "_", ProductArch), displayName=Product, productArch=ProductArch, classification=Classification, InformationId=BulletinID, InformationUrl=tostring(split(BulletinUrl, ";", 0)[0]), osType=1
| union(Update
| where TimeGenerated>ago(14h) and OSType!="Linux" and (Optional==false or Classification has "Critical" or Classification has "Security") and SourceComputerId in ((Heartbeat
| where TimeGenerated>ago(12h) and OSType=~"Windows" and notempty(Computer)
| summarize arg_max(TimeGenerated, Solutions) by SourceComputerId
| where Solutions has "updates"
| distinct SourceComputerId))
| summarize hint.strategy=partitioned arg_max(TimeGenerated, UpdateState, Classification, Title, KBID, PublishedDate, Approved) by Computer, SourceComputerId, UpdateID
| where UpdateState=~"Needed" and Approved!=false
| project-away UpdateState, Approved, TimeGenerated
| summarize computersCount=dcount(SourceComputerId, 2), displayName=any(Title), publishedDate=min(PublishedDate), ClassificationWeight=max(iff(Classification has "Critical", 4, iff(Classification has "Security", 2, 1))) by id=strcat(UpdateID, "_", KBID), classification=Classification, InformationId=strcat("KB", KBID), InformationUrl=iff(isnotempty(KBID), strcat("https://support.microsoft.com/kb/", KBID), ""), osType=2)
| sort by ClassificationWeight desc, computersCount desc, displayName asc
| extend informationLink=(iff(isnotempty(InformationId) and isnotempty(InformationUrl), toobject(strcat('{ "uri": "', InformationUrl, '", "text": "', InformationId, '", "target": "blank" }')), toobject('')))
| project-away ClassificationWeight, InformationId, InformationUrl

Langkah berikutnya