how to custom log format?

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
nieaicai
Posts: 73
Joined: Fri Aug 03, 2012 9:05 pm

how to custom log format?

Post by nieaicai »

hello

hm support many alert way
now i create the alerts profiles use record info into hm log
action parameters is add record into specific log files

but the log files format is defined format
my log below:

[2013-12-11 19:29:28] mail server No answer ping (timeout - 2000 ms) 2397
[2013-12-11 19:31:02] mail server No answer ping (timeout - 2000 ms) 2397
[2013-12-11 19:31:55] mail server Host is alive 47 ms ping (timeout - 2000 ms) 2397


now i need to such format:
[2013-12-11 19:29:28 | mail server No answer |13707382372


notes:

because our sms platform only support format:
time | content| phone number
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You may use "Execure External Program" action with command line like:

Code: Select all

cmd /c D:\scripts\log.bat "%DateTime%" "%TestName%" "%Status%" "%Reply%" "13707382372"
Script (D:\scripts\log.bat) may look like the following:

Code: Select all

SET "SEPARATOR=^|"
@echo %~1%SEPARATOR%%~2%SEPARATOR%%~3%SEPARATOR%%~4%SEPARATOR%%~5 >> D:\logs\log01.txt
nieaicai
Posts: 73
Joined: Fri Aug 03, 2012 9:05 pm

Post by nieaicai »

so good !!! it work fine ! thanke you !!!!!
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Post by KS-Soft Europe »

You are welcome!
Post Reply