use only some of the fields for log to mysql

Hello, I used wowza media server and i’m need to store logs in database. Can I use only some of the fields for log to mysql. I’m not need all fields. But if i use all field, it writing in database, if i used only some of field doesn’t works … Can you help me?

So, this how i created DB in mysql:

CREATE TABLE accesslog ( logid int(10) unsigned NOT NULL AUTO_INCREMENT, date varchar(100) default null, time varchar(100) default null, tz varchar(100) default null, xevent varchar(20) default null, xseverity varchar(100) default null, PRIMARY KEY (logid) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8;

then i edit file log4j.properties:

log4j.rootCategory=info, stdout, serverStats, ServerAccess, ServerError, SQ

log4j.appender.SQ=org.apache.log4j.jdbc.JDBCAppender

log4j.appender.SQ.Driver=com.mysql.jdbc.Driver

log4j.appender.SQ.URL=jdbc:mysql://localhost:3306/wowzalogs

log4j.appender.SQ.user=root

log4j.appender.SQ.password=[CHANGE-PASS]

log4j.appender.SQ.layout=com.wowza.wms.logging.ECLFPatternLayout

log4j.appender.SQ.layout.OutputHeader=false

log4j.appender.SQ.sql=INSERT INTO accesslog (logid, date, time, tz, xevent, xseverity ) VALUES (’%X{logid}’, ‘%X{date}’, ‘%X{time}’, ‘%X{tz}’, ‘%X{x-event}’, ‘%X{x-severity}’ );

then i restarted wowza server and checked DB : select * from accesslog; , but it is empty.

Hello

Yes, as mentioned in ticket #143760, you should be able to use an abridged version that will only log a subset of columns. Similar to what you had, the following worked in a local test:

log4j.appender.SQ=org.apache.log4j.jdbc.JDBCAppender
log4j.appender.SQ.Driver=com.mysql.jdbc.Driver
log4j.appender.SQ.URL=jdbc:mysql://localhost:3306/wowzalogs
log4j.appender.SQ.user=root
log4j.appender.SQ.password=[CHANGE-PASS]
log4j.appender.SQ.layout=com.wowza.wms.logging.ECLFPatternLayout
log4j.appender.SQ.layout.OutputHeader=false
log4j.appender.SQ.sql=INSERT INTO accesslog (date, time, tz, xevent, xcategory, xseverity ) VALUES ('%X{date}', '%X{time}', '%X{tz}', '%X{x-event}', '%X{x-category}', '%X{x-severity}' );

You would just create the table with the date, time, tz, xevent, xcategory, xseverity fields within it and varchars would suffice here.

Thanks,

Matt