Edge 1.11.0

File Tail Trigger Node

The File Tail Trigger allows you to watch and analyze logs and other files that change over time on an Edge Compute Device. This trigger will fire a workflow when it sees that a new line has been written to the end of the configured file.

File Tail Trigger

This node works very similarly to the tail Linux command, except that the File Tail Trigger Node can only output the last line of the configured file instead of a set number of lines.

Node Properties

There are five configurable criteria for a File Tail Trigger:

  • File Path: (Required) The disk location of the file to watch.
  • Parse Method: This field is required and by default is Byte Length. This field can either be Byte Length or Delimiter, and it tells the file listener how to chunk up the data as it is received.
  • Byte Length: This field is required if the parse method is Byte Length and it is the number of bytes to wait for before firing the trigger.
  • Delimiter: The string you are waiting to receive to fire the trigger. This delimiter will not be included in the file content on the payload. If no value is entered, the delimiter will default to /n
  • Output Encoding: This field is required and by default is UTF8. The following are valid character encoding options: ASCII, UTF8, UTF16LE, Base64, Binary, Hex.

File Tail Trigger

Remember, the file path is a path on the file system of the Edge Compute device inside of the container where the Edge Agent is running. If you would like to monitor a file outside of the container, it must be mounted in as a volume.

Payload

The payload will include information about the triggering addition. In the general case, a File Tail workflow will look like the following:

{
  "applicationId": <id of the current application>,
  "applicationName": <name of the current application>,
  "data": {
    "content": <the last line added to the file>,
    "length": <number of characters of the last line added to the file>
  },
  "deviceId": <id of the edge device>,
  "deviceName": <the edge device name>,
  "deviceTags": {<any tags for the edge device>},
  "flowId": <id of the current workflow>,
  "flowName": <name of the current workflow>,
  "flowVersion": <name of the current workflow version>,
  "globals": <object of workflow globals>,
  "isConnectedToLosant": <if the agent is connected to Losant>,
  "agentEnvironment": <object of environment variables>,
  "time": <time that the trigger event arrived>,
  "triggerId": <id of the file tail trigger>,
  "triggerType": "fileTail"
}