I want to differentiate between an attended and unattended robot simply based on the execution logs generated by the robots. I added a custom log field called RobotType: Attended in automations that use attended robots and RobotType: Unattended in automations that use unattended robots.
Afterwards, I updated the NLog.config file as follows with a new rule and target: <rules> <logger name="WorkflowLogging" writeTo="WorkflowLogFilesAttended" final="true"> <filters> <when condition="contains('${message}','Attended')" action="Log"/> </filters> </logger> </rules>
and a new target as follows for the above rule: <target type="File" name="WorkflowLogFilesAttended" fileName="${WorkflowLoggingDirectory}/${shortdate}_Execution_Attended.log" layout="${message}" concurrentWrites="true" encoding="utf-8" writeBom="true" />
The problem is that this target is always being logged even if the when condition is not true. Not sure what I am doing wrong.
Indeed, I have misread the note from the support documentation file, my bad
I did not really try this yet, so I would suggest you to step back and debug in small steps.
My first thought would be to try and filter by a standard log field. Maybe the additional one cannot be processed (itās just a thought, I donāt actually know just yet if that is the case).
Also, I would try to simplify the filter condition to try to see if that will help.
The filter condition at the moment is when condition="contains('${message}','Attended' . I find it as a very simple condition, it just looks if the message from Robot log contains the string Attended. But the thing is having this filter or not does not make any difference, everything is logged regardless of this filter.
@ronlobo Hey, no solution was found. The only way to using NLog filters is to wait for UiPath to update to the new NLog version. Others ways to isolate logs are:
Use Organization Units function and have separate OUs for attended and unattended robots. Logs are isolated among organization units.
Create a Custom Log Field in each RPA solution, call it for example āRobotTypeā that can log either Attended or Unattended. You can then filter logs in Elasticsearch, Splunk or any other Log Management System based on this āRobotTypeā parameter.
Looking for the NLog version embedded with UIPath is a bit complicated. I didnāt find the information in the documentation. By the way, it could be interesting to know the product dependencies for security monitoring purpose, unless UIPath is getting in their contract the responsability to inform their customers if a vulnerability is discovered on dependencies.
Anyway, maybe UIPath embedded a version earlier to 4.6.5 of NLog, so filtering doesnāt work with filter tag but with condition attribute : FilteringWrapper target Ā· NLog/NLog Wiki Ā· GitHub. I will make some test with a 2018 version of the Orchestrator and keep you in touch.
I stumbled accross this post and I think itās worth updating - because itās the first Google result when searching āUiPath NLogāā¦
(Observed on UiPath Ver 2020.4) @rguillome you appear to be correct - āconditionā is the correct keyword. web.config even uses it out of the box for some Insights functions: