@version: 3.2
@include "scl.conf"

options {

 ts_format(iso);
 frac_digits(6);

};

source s_local {
	system();
	internal();
};

source s_network {
        tcp();
};

destination d_local {
	file("/var/log/messages");
};

destination d_pgsql {
 sql(type(pgsql)
 host("localhost") username("logwriter") password("logwriter") port("5432")
 database("syslog")
 table("logs_${HOST}")
  columns("EventTime timestamp", "Hostname varchar(64)", "SeverityValue varchar(40)", "FileName varchar(40)", 
          "EventID varchar(40)", "SourceName varchar(40)", "AccountName varchar(40)", "AccountType varchar(40)",
          "EventType varchar(40)", "Category varchar(40)", "Message text")
  values("$R_ISODATE", "$HOST", "$LEVEL", "$PROGRAM", "$PRIORITY", "$TAG", "$SEG", "$FACILITY", 
         "$EVENTTYPE", "$CATEGORY", "$MSG")
  indexes("EventTime", "Hostname", "SeverityValue", "FileName", "EventID", "SourceName", "AccountName", "AccountType",
          "EventType", "Category", "Message")); 
 };

log {
	source(s_local);
	destination(d_local);
	source(s_network);
	destination(d_pgsql);
};
