Azure App ServiceにインストールしたOrchestratorのログ取得手順

:grey_question: Question

Azure App ServiceにインストールしたOrchestratorの調査ログはどのように取得しますか?

:bulb: Answer

Azure App Serviceにインストールした場合、Azure App Serviceのアプリケーションイベントログと、OrchestratorやIdentity ServerなどUiPathが出力するログの2つに分けて出力されます。
Azure App Serviceのアプリケーションイベントログには、.NET Runtime や IIS AspNetCore Module V2 などからのログが出力されます。

Azure App Serviceのログ取得手順

  1. Azureポータルから、調査対象のアプリ(Orchestrator、Identity Server、Webhook、Resource Catalog)をインストールしたAzure Web アプリ画面を開きます。

  2. 開発ツール > 高度なツール画面で、「移動→」ボタンをクリックします。

  3. 新しいタブで「Kudu」の画面が開かれたら、Debug console > CMDと進みます。

  4. 「LogFiles」をクリックし、LogFilesフォルダーに移動します。

  5. 「eventlog.xml」ファイル左端のダウンロードアイコンをクリックして、ダウンロードします。

参考:アプリケーション イベント ログ (Azure App Service)

Orchestratorのログ取得手順

Orchestratorのログ出力先は、OrchestratorのAzure Web アプリの wwwroot\UiPath.Orchestrator.dll.config ファイルで設定します。

Azure MarketplaceからOrchestratorをインストールして UiPath.Orchestrator.dll.config ファイルが次のように設定されている場合は、以下の手順でOrchestratorのログを取得します。

ログが出力されていない場合には、UiPath.Orchestrator.dll.config ファイルを次のように編集して事象再現することで、ログを取得できます。

<nlog>
  <targets>
    <target name="fileLog" xsi:type="AsyncWrapper">
      <target xsi:type="File" name="fileLogInner" fileName="${gdc:item=logDirectory:whenEmpty=${basedir}/logs}/logfile.txt" layout="${date:format=yyyy-MM-dd HH\:mm\:ss.fff} [${level}] ${logger}${literal:text= request=:when=length('${mdlc:item=Correlation}')&gt;0}${mdlc:item=Correlation} ${message}${onexception:${newline}${ui-pretty-exception}}" maxArchiveFiles="7" archiveAboveSize="1048576" archiveEvery="Day" />
    </target>
    (中略)
  </targets>
  <rules>
    (中略)
    <logger name="*" minlevel="Warn" writeTo="fileLog" />
  </rules>
</nlog>
  1. Orchestratorの Azure Web アプリにアクセスし、Azure App Serviceのログ取得手順の2番~4番を実施します。

  2. 「Kudu」のLogFilesフォルダー内で「_orchestrator」をクリックし、_orchestratorフォルダーに移動します。

  3. _orchestratorフォルダー内にあるファイルを全て、左端のダウンロードアイコンをクリックしてダウンロードします。

Identityのログ取得手順

Identity Serverのログ出力先は、Identity ServerのAzure Web アプリの wwwroot\Web\appsetting.json ファイルで指定します。

既定値ではAzure Web アプリにログファイルを出力する設定になっていません。

appsetting.json ファイルの「Nlog」セクションを以下のように編集して保存し、Identity Serverを再起動して設定反映後に事象を再現することでログを取得できます。

  "NLog": {
    "IncludeScopes": true,
    "throwConfigExceptions": false,
    "targets": {
      "EventLog": {
        "type": "EventLog",
        "source": "IdentityService",
        "layout": "${longdate} ${logger} ${message}${onexception:${newline}${exception:maxInnerExceptionLevel=10:format=shortType,message,stacktrace:separator=*:innerExceptionSeparator=&#xD;&#xA;&#x9;}}"
      },
      "azureLogFile": {
        "type": "File",
        "fileName": "./${shortdate}-IdentityApplication.log",
        "layout": "${longdate} - ${level:uppercase=true} - ${logger} ${message}${onexception:${newline}${exception:maxInnerExceptionLevel=10:format=shortType,message,stacktrace:separator=*:innerExceptionSeparator=&#[x9;}}",
        "archiveEvery": "Day",
        "maxArchiveFiles": "5"
      }
    },
    "rules": [
      {
        "logger": "*",
        "minLevel": "Info",
        "writeTo": "azureLogFile"
      }
    ]
  },

上記のように編集して保存してIdentity Serverを再起動後に、以下の手順でログを取得できます。

  1. Identity Serverの Azure Web アプリにアクセスし、Azure App Serviceのログ取得手順の2番~3番を実施します。

  2. 「sites」をクリックし、sitesフォルダーに移動します。

  3. 同様にwwwrootフォルダーに移動し、さらにWebフォルダーに移動します。

  4. 「yyyy-MM-dd-IdentityApplication.log」形式のファイルがあるので、ファイル左端のダウンロードアイコンをクリックしてダウンロードします。