none
Log Analyticsでイベントログ収集時に収集されないログがある RRS feed

  • 質問

  • お世話になります。

    OMSのLog Analyticsを利用しAzure上のWindows Server(2012R2 Datacenter)をインストールしたVMからイベントログを収集しているのですが一部収集されないログがあり困っています。

    具体的には以下のような状態です。

    1.Windows Server 上で Powershell を用いてWrite-EventLogコマンドによりイベントログを書き込む

    2.このとき、-EntryType に Error か Warning か Information を指定したログは収集される

    3.-EntryType に SuccessAudit か FailureAudit を指定したログは収集されない

    4.-EntryType に SuccessAudit か FailureAudit を指定したログはイベントビューワ上ではレベルが「情報」で、全般タブのキーワードという項目に、クラシックのほかに「成功の監査」や「失敗の監査」が追加される。

    5.OMSでのイベントログ収集設定は次の通り。

     設定→Data→Windows イベントログ→収集するイベントログ名の登録、Error、Warning、Informationの3つすべてにチェック

    質問としては以下です。

    Q1.そもそもなのですが上記のようなイベントログはLogAnalyticsでは収集されないのが通常の動作でしょうか?

    Q2.上記のようなイベントログをLogAnalyticsで収集したい場合どのような手段があるでしょうか?

    以上です。

    よろしくお願いします。

    2016年12月22日 2:14

回答

  • 素人ですが検索した限り、Adminからの回答ではイベントログの表示の仕様のようです。

    But the policy in the portal today does not allow to select Audit Failure or Audit Success – this is because they are typically not many apps using those… not being the most common use case, we don’t want to give too many knobs/complicate the UI for this.

    https://feedback.azure.com/forums/267889-log-analytics/suggestions/6664082-application-log-id-18456-logon-not-being-collect

    System.Diagnostics.EventLogEntryTypeはビットフラグのように2進数の値を取り、

    Error=1, Warning=2, Information=4, SuccessAudit=8, FailureAudit=16

    となっていますが、Orは取れないので、Error=1, Warning=2, Information=4しか選択肢がないと選択できないのでしょう。

    イベントビューアでは、便宜上「情報」となっていますが、Information=4以上であることを指しているに過ぎないと思います。

    PowerShellではなく、C#スクリプト (LinqPad)で恐縮ですが、簡単な確認プログラムです。

    <Query Kind="Program">
      <Output>DataGrids</Output>
      <Namespace>Microsoft.Win32</Namespace>
      <Namespace>System.Diagnostics</Namespace>
      <Namespace>System.Diagnostics.Tracing</Namespace>
      <Namespace>System.Linq</Namespace>
    </Query>
    
    // File Name: SecurityEventLog.linq
    
    void Main()
    {
    	// LinqPad (http://www.linqpad.net/)で実行可能なスクリプト.
    	// LinqPadを管理者権限で実行する必要あり.
    
    	// https://msdn.microsoft.com/ja-jp/library/system.diagnostics.eventlogentrytype(v=vs.110).aspx
    	// EntryTypeの値と名前を列挙.
    	Enum.GetValues(typeof(EventLogEntryType)).Cast<EventLogEntryType>().Select(x => new { Value = (int)x, Name = x }).Dump();
    	
    	// https://msdn.microsoft.com/ja-jp/library/system.diagnostics.eventlog(v=vs.110).aspx
    	var security = new EventLog("Security");
    	
    	// 数が多いので個数を制限.
    	//var entries = security.Entries.Cast<EventLogEntry>();
    	var entries = security.Entries.Cast<EventLogEntry>().Take(3000);
    
    	// ログのエントリからエントリに含まれているSourceを列挙 (登録されているものの一部).
    	entries.Select(entry => entry.Source).Distinct().OrderBy(source => source).Dump();
    
    	// ログのエントリからエントリに含まれているEntryTypeを列挙.
    	// SuccessAudit=8, FailureAudit=16が候補.
    	var entryTypes = entries.Select(entry => entry.EntryType).Distinct();
    	entryTypes.Dump();
    	
    	// Error=1, Warning=2, Information=4のみ選択する。SuccessAudit=8, FailureAudit=16のみなら0のはず.
    	entryTypes.Where(x => x <= EventLogEntryType.Information).Dump();
    
    	// https://msdn.microsoft.com/ja-jp/library/microsoft.win32.registrykey(v=vs.110).aspx
    	// https://msdn.microsoft.com/ja-jp/library/windows/desktop/aa363648(v=vs.85).aspx
    	// https://msdn.microsoft.com/ja-jp/library/windows/desktop/aa363661(v=vs.85).aspx
    	// システムに登録されているログファイルの内、Securityログに登録されているSourceをすべて列挙する.
    	var securityLogKeyPath = @"SYSTEM\CurrentControlSet\services\eventlog\Security";
    	var localMachineKey = Registry.LocalMachine;
    	using (var securityLogKey = Registry.LocalMachine.OpenSubKey(securityLogKeyPath))
    	{
    		securityLogKey.GetSubKeyNames().OrderBy(source => source).Dump();
    	}
    }

    なお、Security Intelligence Packというのを検索すると、以下の情報が見つかりました。

    https://social.msdn.microsoft.com/Forums/SqlServer/en-US/53119f4b-6470-44fc-af60-316184c2af33/security-event-log-connot-be-collected-by-this-intelligence-pack?forum=opinsights



    2016年12月28日 11:39

すべての返信

  • 素人ですが検索した限り、Adminからの回答ではイベントログの表示の仕様のようです。

    But the policy in the portal today does not allow to select Audit Failure or Audit Success – this is because they are typically not many apps using those… not being the most common use case, we don’t want to give too many knobs/complicate the UI for this.

    https://feedback.azure.com/forums/267889-log-analytics/suggestions/6664082-application-log-id-18456-logon-not-being-collect

    System.Diagnostics.EventLogEntryTypeはビットフラグのように2進数の値を取り、

    Error=1, Warning=2, Information=4, SuccessAudit=8, FailureAudit=16

    となっていますが、Orは取れないので、Error=1, Warning=2, Information=4しか選択肢がないと選択できないのでしょう。

    イベントビューアでは、便宜上「情報」となっていますが、Information=4以上であることを指しているに過ぎないと思います。

    PowerShellではなく、C#スクリプト (LinqPad)で恐縮ですが、簡単な確認プログラムです。

    <Query Kind="Program">
      <Output>DataGrids</Output>
      <Namespace>Microsoft.Win32</Namespace>
      <Namespace>System.Diagnostics</Namespace>
      <Namespace>System.Diagnostics.Tracing</Namespace>
      <Namespace>System.Linq</Namespace>
    </Query>
    
    // File Name: SecurityEventLog.linq
    
    void Main()
    {
    	// LinqPad (http://www.linqpad.net/)で実行可能なスクリプト.
    	// LinqPadを管理者権限で実行する必要あり.
    
    	// https://msdn.microsoft.com/ja-jp/library/system.diagnostics.eventlogentrytype(v=vs.110).aspx
    	// EntryTypeの値と名前を列挙.
    	Enum.GetValues(typeof(EventLogEntryType)).Cast<EventLogEntryType>().Select(x => new { Value = (int)x, Name = x }).Dump();
    	
    	// https://msdn.microsoft.com/ja-jp/library/system.diagnostics.eventlog(v=vs.110).aspx
    	var security = new EventLog("Security");
    	
    	// 数が多いので個数を制限.
    	//var entries = security.Entries.Cast<EventLogEntry>();
    	var entries = security.Entries.Cast<EventLogEntry>().Take(3000);
    
    	// ログのエントリからエントリに含まれているSourceを列挙 (登録されているものの一部).
    	entries.Select(entry => entry.Source).Distinct().OrderBy(source => source).Dump();
    
    	// ログのエントリからエントリに含まれているEntryTypeを列挙.
    	// SuccessAudit=8, FailureAudit=16が候補.
    	var entryTypes = entries.Select(entry => entry.EntryType).Distinct();
    	entryTypes.Dump();
    	
    	// Error=1, Warning=2, Information=4のみ選択する。SuccessAudit=8, FailureAudit=16のみなら0のはず.
    	entryTypes.Where(x => x <= EventLogEntryType.Information).Dump();
    
    	// https://msdn.microsoft.com/ja-jp/library/microsoft.win32.registrykey(v=vs.110).aspx
    	// https://msdn.microsoft.com/ja-jp/library/windows/desktop/aa363648(v=vs.85).aspx
    	// https://msdn.microsoft.com/ja-jp/library/windows/desktop/aa363661(v=vs.85).aspx
    	// システムに登録されているログファイルの内、Securityログに登録されているSourceをすべて列挙する.
    	var securityLogKeyPath = @"SYSTEM\CurrentControlSet\services\eventlog\Security";
    	var localMachineKey = Registry.LocalMachine;
    	using (var securityLogKey = Registry.LocalMachine.OpenSubKey(securityLogKeyPath))
    	{
    		securityLogKey.GetSubKeyNames().OrderBy(source => source).Dump();
    	}
    }

    なお、Security Intelligence Packというのを検索すると、以下の情報が見つかりました。

    https://social.msdn.microsoft.com/Forums/SqlServer/en-US/53119f4b-6470-44fc-af60-316184c2af33/security-event-log-connot-be-collected-by-this-intelligence-pack?forum=opinsights



    2016年12月28日 11:39
  • tmori3y2様

    返信ありがとうございます。

    (確認プログラムまで作成して頂きありがとうございます。)

    つまりは以下のようなことだと認識しました。

    ・SuccessAudit と FailureAudit はイベントビューア上では Information に「見えているだけ」で、中身はErrorでもWarningでもInformationでもない

    ・Log Analyticsのイベントログ収集設定ではError、Warning、Informationしか収集対象に選べないから、そのどれでもないSuccessAudit と FailureAudit は収集されない

    イベントログは LogAnalytics で収集・参照したいと考えていますので、 SuccessAudit と FailureAudit はなるべく用いない方向にしようと思います。

    ありがとうございました。

    2017年1月4日 4:43