Freigeben über


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

  • Anonymous
    March 10, 2017
    How about $OutputEncoding = New-Object -TypeName System.Text.UTF8Encoding
  • Anonymous
    March 28, 2017
    The comment has been removed
  • Anonymous
    July 07, 2017
    Hi Brian.Thanks a lot for your post!Andreas