Skip to content

File Monitoring

File monitoring provides you the ability to monitor a file (log file, config file etc.) in your devices for any changes. File monitoring provides you two options:

  1. File Modifications Monitoring
  2. Log File Monitoring

File Modifications Monitoring

File modifications monitoring will monitor a file for any modifications and generate webhook alerts whenever the file gets modified.

If a file gets modified, the file size changes and the last modified time of the file changes. SocketXP agent will monitor these two parameters and trigger an alert when they change.

Go to the SocketXP web portal's monitoring section, where you will register the public webhook URL of your app (Eg: https://api.example.com/device-monitoring-webhook). You'll receive webhook alerts in your app via this registered webhook URL.

IoT Remote Device File Monitoring

To receive webhook alerts whenever a file gets modified, you need to provide:

  • the full path of the file to monitor (Eg: /var/log/myapp.log),
  • turn on file modifications monitoring,
  • provide a poll interval (default is 300 seconds or 5 minutes) for polling the file for any modifications,
  • finally, click the update button to push the new configuration to all devices in your account.

You'll receive webhook alerts as shown below whenever the file gets modified:

{
    "DeviceId":"1234aaaa-bbbb-ccccc-ddddd1234",
    "DeviceName":"Sensor123",
    "FileName":"/var/log/myapp.log",
    "FileModified":true,
    "FileLastModTime":"2023-04-30 20:47:09.133572425 +0530 UTC",
    "FileSize":464372
}

Tip

All the alerts generated can be viewed from the "Activity Logs" section in the SocketXP Web Portal.

Note

  1. SocketXP agent running in all your devices will be restarted whenever you make any change to the file monitoring configurations.
  2. File monitoring alerts are throttled to a 5 minute window - meaning not more than 1 alert will be sent in any 5 minute window for a given device.
  3. File monitoring feature is available from SocketXP agent version 1.4.0 onwards.

Log File Monitoring

Log file monitoring feature will monitor your IoT application's log file for any error log written to it. You'll provide an error string or a regex pattern as an input to Log file monitoring. Log file monitoring will use the regex pattern to continuously monitor the logs written to your log file. Log file monitoring will generate a webhook alert whenever a log written to the log file matches with the regex pattern provided.

Go to the SocketXP web portal's monitoring section, where you will register the public webhook URL of your app (Eg: https://api.example.com/device-monitoring-webhook). You'll receive webhook alerts in your app via this registered webhook URL.

IoT Remote Device File Monitoring

To receive alerts whenever a specific error message is written to a log file, you need to provide: - the full path of the log file to monitor (Eg: /var/log/syslog), - turn on Log file monitoring, - provide a string or a regex pattern to match - finally, click the update button to push the new configuration to all devices in your account

You'll receive webhook alerts as shown below whenever the regex pattern matches with a log written to the log file:

{
    "DeviceId":"1234aaaa-bbbb-ccccc-ddddd1234",
    "DeviceName":"Sensor123",
    "FileName":"/var/log/myapp.log",
    "RegexMatched":true,
    "MatchedText":"my error string"
}

Note

You need to input the string or the regex pattern without any quotes around them.

Eg: my error string

Eg: ^my.*string$

Eg: .*error.*