0

I have a custom application running on client which uses php, whose log's are controlled by log4php.properties ( say DEBUG or INFO ) however, in addtion existing logging setup, i would like to send these logs to syslog-ng running server.

Below is my syslog-ng configuration on client ( where php application is running )
File - /etc/syslog-ng/syslog-ng.conf entry,

destination loghost {
        tcp("192.168.1.123" port(5140));
};
log {
        source(src);
        destination(loghost);
};

And on the client log4php.properties,
log4php.appender.A2=LoggerAppenderSyslog
log4php.appender.A2.MaxFileSize=10MB
log4php.appender.A2.Priority=DEBUG
log4php.appender.A1.layout.ConversionPattern="%d{d M Y} %d{ABSOLUTE} %X{server.REMOTE_ADDR} %c{2} %-5p %m %n"

However, i am able to see the logs generated by my application under syslog folder in a file called - user-log - my question is - how can i customize the log entries? and is it possible to move these logs to some other file name ?

Any pointers are greatly helpful.

Thanks.

cb24
  • 61
  • 2
  • 6

1 Answers1

0

Please note that the properties file format is deprecated with current versions of log4php. Please upgrade to a better format. I always prefer native PHP arrays, but XML will work equally well.

Your configuration does not make sense in some details:

  • There is no MaxFileSize for a syslog appender.
  • The layout should be for appender "A2", not "A1"

Some data is missing:

  • You should provide an ident string if you do not like the default of "Apache lopg4php".
  • Which facility do you want to log on? Default is "USER".
  • Which priority do you want to use? If you define not to override the priority, then the log level of the logged event is used here, but the level log4php offers does not completely map to the ones syslog offers. Using a defined priority here might be a good ide for the start.

See the docs for some details: http://logging.apache.org/log4php/docs/appenders/syslog.html

Sven
  • 69,403
  • 10
  • 107
  • 109