- Script/App to run on windows machine every X (interval) minutes
- Script/App will scan/read (without locking the file for writes as logs are in use almost every second) in each defined paths the text file
acclog.txt
#INSTALL_DIR\
#ACCOUNT1\
#ACCOUNT2\
…
acclog.txt
- From the bottom of the text file, find first line with occurrence of timestamp in brackets at the beginning of the line 12hour format [ mm-dd hh:mm:ss xm ]
example: [ 04-12 02:03:23 pm ] from the 2nd line from he bottom as most bottom line did not had timestamp in brackets
sample line: [ 04-12 02:03:23 pm ] [ warning ] resetting connection
will convert that time into desire 24hours format and store in $timestamp1 (according account number)
- will read next text after timestamp also located in brackets and will store it in $status1 (according account number)
example: [ warning ] stored as warning
- rest of the line stored as $desc1
example: resetting connection
- will call url of each account webhook to activate remote processing
url compiled using defined webhook per account #webhook1 and variables from log files on respective account number
exampled:
configured #webhook1 =
https://trigger.macrodroid.com/deviceID1/triggerID1
Called URLs:
#WEBHOOK1?timestamp=$TIMESTAMP1&status=$STATUS1&desc=$DESC1
#WEBHOOK2?timestamp=$TIMESTAMP2&status=$STATUS2&desc=$DESC2
Final example of called webhook:
https://trigger.macrodroid.com/deviceID1/triggerID1?timestamp=20210413153040?status=Warning?desc=Resetting connection
Config file proposal sample:
interval 5
install_dir C:\Program Files\applicationXY
timestampformat YYYYMMDDHHMMSS
account1 12345678
webhook1
https://trigger.macrodroid.com/deviceID1/triggerID1
account1 87654321
webhook1
https://trigger.macrodroid.com/deviceID2/triggerID2
Delivery term: Not specified