| Version 2 (modified by , 4 years ago) (diff) |
|---|
Write Naemon Log
We can write to naemon.log file by issue command
OMD[monitor@501264b41d2d]:~/var/naemon$ pwd /omd/sites/monitor/var/naemon OMD[monitor@501264b41d2d]:~/var/naemon$ echo "[$(date +%s)] User Activity msg TEST log" >> naemon.log
Linux command date +%s will print time in current time since Epoch 1970
In C program, we can implement this function with bash shell via system( bash cmd )
int writeLogFile( char *msg )
{
char str_msg[1024];
sprintf( str_msg, "echo \"[%d] User Activity %s \" >> /omd/sites/monitor/var/naemon/naemon.log",(int)time(NULL), msg);
printf(str_msg);
system(str_msg);
return 0;
}
Attachments (2)
- log-viewer-1.0.1.zip (12.2 MB) - added by 4 years ago.
- log-viewer-1.0.1.tar.gz (1.2 MB) - added by 4 years ago.
Download all attachments as: .zip
![(please configure the [header_logo] section in trac.ini)](/Utils/chrome/site/your_project_logo.png)