Question
Azure App ServiceにインストールしたOrchestratorの調査ログはどのように取得しますか?
Answer
Azure App Serviceにインストールした場合、Azure App Serviceのアプリケーションイベントログと、OrchestratorやIdentity ServerなどUiPathが出力するログの2つに分けて出力されます。
Azure App Serviceのアプリケーションイベントログには、.NET Runtime や IIS AspNetCore Module V2 などからのログが出力されます。
Azure App Serviceのログ取得手順
-
Azureポータルから、調査対象のアプリ(Orchestrator、Identity Server、Webhook、Resource Catalog)をインストールしたAzure Web アプリ画面を開きます。
-
開発ツール > 高度なツール画面で、「移動→」ボタンをクリックします。
-
新しいタブで「Kudu」の画面が開かれたら、Debug console > CMDと進みます。
-
「LogFiles」をクリックし、LogFilesフォルダーに移動します。
-
「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}')>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>
-
Orchestratorの Azure Web アプリにアクセスし、Azure App Serviceのログ取得手順の2番~4番を実施します。
-
「Kudu」のLogFilesフォルダー内で「_orchestrator」をクリックし、_orchestratorフォルダーに移動します。
-
_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=
	}}"
},
"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を再起動後に、以下の手順でログを取得できます。
-
Identity Serverの Azure Web アプリにアクセスし、Azure App Serviceのログ取得手順の2番~3番を実施します。
-
「sites」をクリックし、sitesフォルダーに移動します。
-
同様にwwwrootフォルダーに移動し、さらにWebフォルダーに移動します。
-
「yyyy-MM-dd-IdentityApplication.log」形式のファイルがあるので、ファイル左端のダウンロードアイコンをクリックしてダウンロードします。