-1

I want to monitor a log file that's on Linux on SCOM.

The log is from postgresql. The path is /var/lib/pgsql/9.4/data/pg_log/postgresql-2017-08-21.log.

The thing is, that if I put that string it works, but I can't seem to make it work with wildcards for the dates.

I already tried /var/lib/pgsql/9.4/data/pg_log/postresql-%Y-%m-%d.log but no luck.

Any thoughts?

U880D
  • 8,601
  • 6
  • 24
  • 40
sabri128
  • 91
  • 1
  • 2
  • 7

2 Answers2

1

SCOM does not provide the same log file monitoring capabilities on Linux than on Windows. On Linux it can only monitor one file from a monitoring template, there is no support for file patterns. I can recommend using one of the following ways to workaround this limitation (in increasing complexity order):

  1. Make the application log to one file (by disabling log file rotation, or by using a script that appends the log into a separate file for SCOM monitoring)
  2. Transfer the log files to a Windows server which has SCOM Agent installed and monitor the files from there. Don't forget that the files need to be converted from UNIX line endings (\n) to DOS/Windows line endings (\r\n).
  3. Develop some script-based (i.e.: Python) solution that follows the log file rotation. While this can cover all future requirements (i.e.: alerting for more patterns in the logs), it adds a lot of complexity to the system
LietKynes
  • 2,953
  • 1
  • 15
  • 10
-1

you can try :

/var/lib/pgsql/9.4/data/pg_log/postresql-$(date +"%Y-%m-%d").log
Dharman
  • 30,962
  • 25
  • 85
  • 135
  • When I put that on the log file path it says "The log file path contains an unsopported character"... it does not support the ( ) characters. – sabri128 Aug 21 '17 at 14:09
  • $ echo /var/lib/pgsql/9.4/data/pg_log/postresql-$(date +"%Y-%m-%d").log /var/lib/pgsql/9.4/data/pg_log/postresql-2017-08-21.log – bedjaoui djounaydi Aug 21 '17 at 14:45
  • whene I try : echo /var/lib/pgsql/9.4/data/pg_log/postresql-$(date +"%Y-%m-%d").log I get : /var/lib/pgsql/9.4/data/pg_log/postresql-2017-08-21.log – bedjaoui djounaydi Aug 21 '17 at 14:49
  • [root@xxxxxxxx prueba]# echo /var/lib/pgsql/9.4/data/pg_log/postresql-$(date +"%Y-%m-%d").log /var/lib/pgsql/9.4/data/pg_log/postresql-2017-08-21.log The thing is, that scom (operation manager) does not support that string. – sabri128 Aug 21 '17 at 14:52
  • It only work if I hardcode the file name... but that would only work for one day, its not dynamic – sabri128 Aug 21 '17 at 14:52