Where is my custom log data?


The ability of OMS to ingest custom log files enables almost limitless possibilities for you to collect and analyse data from your systems. In fact, a common usage is for customers to use their own PowerShell scripts to collect, collate and create custom logs for uploading and analysis.

If this sounds appealing, you can read more about setting up custom logs at Custom logs in Log Analytics.

I am not writing this to beat the drum for using customer logs but to make you aware of a gotcha that I’ve seen a few of our customers hit when doing this.

We currently only support the ASCII and UTF-8 encodings. This is especially relevant if you are using the PowerShell out-file cmdlet because it defaults to UTF-16.

So, when writing your custom log file, be sure to include the -encoding switch and specify either ASCII or UTF-8.

For example:

out-file -Encoding utf8 -FilePath c:\logs\somelog.log

Brian McDermott
Senior Escalation Engineer
Microsoft

Comments (3)
  1. Dale Thompson says:

    How about

    $OutputEncoding = New-Object -TypeName System.Text.UTF8Encoding

  2. Phil says:

    Thanks for posting this Brian, I was waiting for our logs to appear in OMS and after an hour and a half they still hadn’t showed! The reason is I was using out-file with default encoding. Posting this saved me a lot of time and head scratching so THANK YOU!

  3. Andreas says:

    Hi Brian.
    Thanks a lot for your post!
    Andreas

Comments are closed.

Skip to main content