Custom Logs on AKS & Azure Monitor

%3CLINGO-SUB%20id%3D%22lingo-sub-2063983%22%20slang%3D%22en-US%22%3ECustom%20Logs%20on%20AKS%20%26amp%3B%20Azure%20Monitor%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2063983%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20containers%20deployed%20in%20AKS.%20Those%20containers%20log%20into%20custom%20files.%20I%20want%20to%20analyse%20those%20logs%20using%20Azure%20Monitor%20(Log%20Analytics).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EKindly%20provide%20the%20steps%20to%20achieve%20that.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20You%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2064972%22%20slang%3D%22en-US%22%3ERe%3A%20Custom%20Logs%20on%20AKS%20%26amp%3B%20Azure%20Monitor%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2064972%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F930395%22%20target%3D%22_blank%22%3E%40Ajay_Kumar_Sharma%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20write%20app%20logs%20to%20STDOUT%20and%20then%20oms%20agent%20will%20push%20these%20logs%20to%20log%20analytics%20workspace.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20can%20refer%20to%20logs%20under%20container%20logs%20...%20using%20Log%20Query%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-applescript%22%3E%3CCODE%3EContainerLog%0A%7C%20project%20TimeGenerated%20%20%2CLogEntry%2C%20LogEntrySource%3C%2FCODE%3E%3C%2FPRE%3E%3CDIV%3E%26nbsp%3B%3C%2FDIV%3E%3CP%3Emore%20on%26nbsp%3B%20%26nbsp%3B%20%3CA%20href%3D%22https%3A%2F%2Fyoutube.com%2Fwatch%3Fv%3DRjsNmapggPU%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fyoutube.com%2Fwatch%3Fv%3DRjsNmapggPU%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

I have containers deployed in AKS. Those containers log into custom files. I want to analyse those logs using Azure Monitor (Log Analytics).

 

Kindly provide the steps to achieve that.

 

Thank You

2 Replies

@Ajay_Kumar_Sharma 

You can write app logs to STDOUT and then oms agent will push these logs to log analytics workspace.

 

You can refer to logs under container logs ... using Log Query 

ContainerLog
| project TimeGenerated  ,LogEntry, LogEntrySource
 

more on    https://youtube.com/watch?v=RjsNmapggPU

@Ajay_Kumar_Sharma 

 

Hi what is format of your log files ? 

If you don't use  OMS agent you can use externaldata operator to read files, like csv or tsv, scsv, sohsv, psv, txt, raw.

https://docs.microsoft.com/en-us/azure/data-explorer/kusto/query/externaldata-operator?pivots=azured...

You can also parse text or use predefined  structures like 

JSON

XML

IPv4

URL

URL query

File path

User agent

Version string

https://docs.microsoft.com/fr-fr/azure/azure-monitor/log-query/parse-text