The process of configuring Elastic Search to work with ProcessRobot is described below


Step 1: Open Log4Net.config from the installation folder, using a text editor - by default located at "C:\Program Files\ProcessRobot\Server"


Step 2: Remove the comments at lines 11,16, 19, 24, 33, 36, 44 (either "<!--" or "-->" signs)


<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <log4net debug="false">
    <root>
      <level value="INFO" />
      <appender-ref ref="sqlServer" />
      <!-- uncomment to enable uploading logs to ElasticSearch -->
      <appender-ref ref="LogElasticSearchAppender"/>
    </root>
    <logger name="Quartz" additivity="false"/>

    <!-- Uncommnet to enable uploading kpi to ElasticSearch -->
    <logger name="KPILogger" additivity="false">
      <level value="INFO" />
      <appender-ref ref="KPIElasticSearchAppender" />
    </logger>

    <!-- Wiki of log4net.ElasticSearch https://github.com/jptoto/log4net.ElasticSearch/wiki -->
    <!-- set bufferSize to 0 to upload to ElasticSearch immediately  -->
    <!-- Appender to Log to ElasticSearch -->
    <appender name="LogElasticSearchAppender" type="log4net.ElasticSearch.ElasticSearchAppender, log4net.ElasticSearch">
      <connectionString value="Scheme=https;User=username;Pwd=password;Server=localhost;Index=prlog;Port=9200;rolling=false"/>
      <eventType value="log"/>
      <lossy value="false" />
      <evaluator type="log4net.Core.LevelEvaluator">
        <threshold value="ERROR" />
      </evaluator>

      <bufferSize value="100" />
    </appender>

    <!-- Appender to send KPI Entries to ElasticSearch -->
    <appender name="KPIElasticSearchAppender" type="log4net.ElasticSearch.ElasticSearchAppender, log4net.ElasticSearch">
      <connectionString value="Scheme=https;User=username;Pwd=password;Server=localhost;Index=prkpi;Port=9200;rolling=false"/>
      <eventType value="kpi"/>
      <lossy value="false" />
      <evaluator type="log4net.Core.LevelEvaluator">
        <threshold value="ERROR" />
      </evaluator>
      <bufferSize value="100" />
    </appender>

    <appender name="sqlServer" type="WinAutomation.Server.Log4NetAppender">
      <bufferSize value="1" />
      <ReconnectOnError value="true" />
      <!--log when >= INFO -->
      <connectionType value="System.Data.SqlClient.SqlConnection,System.Data,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" />
      <commandText value="INSERT INTO Logs ([timestamp], [path],[process_name], [instance_id],[robot_name],[user_name], [event_id], [level], [message], [additional_data], [parent_id], [queue_name], [log_screenshot_id], [video_log_id], [process_id]) VALUES(@TimeStamp, @Path, @ProcessName, @InstanceId, @RoboName, @UserName, @EventId, @Level, @Message, @AdditionalData, @ParentId, @QueueName, @LogScreenshotId, @VideoLogId, @ProcessId)" />
      <parameter>
        <parameterName value="@TimeStamp" />
        <dbType value="DateTime2" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="Timestamp" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@Path" />
        <dbType value="String" />
        <size value="-1" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="Path" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@ProcessName" />
        <dbType value="String" />
        <size value="-1" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="ProcessName" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@InstanceId" />
        <dbType value="Guid" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="InstanceId" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@RoboName" />
        <dbType value="String" />
        <size value="-1" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="RobotName" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@UserName" />
        <dbType value="String" />
        <size value="-1" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="UserName" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@EventId" />
        <dbType value="Int64" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="EventId" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@Level" />
        <dbType value="String" />
        <size value="-1" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%level" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@Message" />
        <dbType value="String" />
        <size value="-1" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%message" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@AdditionalData" />
        <dbType value="String" />
        <size value="-1" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="AdditionalData" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@ParentId" />
        <dbType value="Guid" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="ParentId" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@ProcessId" />
        <dbType value="Guid" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="ProcessId" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@LogScreenshotId" />
        <dbType value="Guid" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="LogScreenshotId" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@VideoLogId" />
        <dbType value="Guid" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="VideoLogId" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@QueueName" />
        <dbType value="String" />
        <size value="-1" />
        <layout type="log4net.Layout.RawPropertyLayout">
          <key value="QueueName" />
        </layout>
      </parameter>
    </appender>
  </log4net>
</configuration>


Step 3: Now replace the values at lines 25 and 37 with the ones that apply to your ElasticSearch installation.

  • Scheme: http or https depending on the server the installation is on
  • User: ElasticSearch Username.
  • Pwd: ElasticSearch Password.
  • Server: ElasticSearch Server Address (When on cluster do not use IP).
  • Index: The indices used to categorize records to Elastic and Kibana.
  • Port: ElasticSearch Port.
  • bufferSize: The amount of records that gets buffered before sent to Elastic (Set 0 for instant upload).


Step 4: After changing the above values, save the .config file as Administrator and restart ProcessRobot.Server Service.

Step 5: On Kibana’s Monitoring Page, turn on Monitoring.

Step 6: Use ProcessRobot to create logs or KPIs, which will automatically upload to Elastic, and navigate on the  Kibana’s Management Page to create the Index Patterns matching the prkpi and prlog indices respectively.