Solved pkg non-default installation

I need to keep certain system log entries in a database. I have installed and configured MySQL server and client. I have also installed the syslog-ng package. Then I configure the
Code:
/usr/local/etc/syslog-ng.conf
file as seen below:

Code:
@version:3.6
@include "scl.conf"

source DEFAULT
{
 network
 (
  ip(127.0.0.1)
  port(5140)
  transport("udp")
 );
};

# DHCP
filter dhcpd_filter
{
 program("dhcpd") and
 message("DHCPACK on");
};

parser dhcpd_parser
{
 csv-parser
 (
  columns("MSG.ACK","MSG.ON","MSG.IP","MSG.TO","MSG.MAC","MSG.HOSTNAME")
  flags(escape-none, strip-whitespace)
  delimiters(" ")
 );
};

destination dhcp_sql
{
  sql
  (
    type(mysql)
    host("localhost") username("log_writer") password("0000")
    database("log_db")
    table("dhcp")
    columns("logtime", "mac_address", "ip_address", "hostname")
    values("$R_DATE", "${MSG.MAC}", "${MSG.IP}", "${MSG.HOSTNAME}")
  );
};

log
{
 source(DEFAULT);
 filter(dhcpd_filter);
 parser(dhcpd_parser);
 destination(dhcpd_sql);
};

But when I start the service, syslog-ng complains:

Code:
Starting syslog_ng.
Error parsing destination, destination plugin sql not found in /usr/local/etc/syslog-ng.conf at line 43, column 3:

  sql
  ^^^

syslog-ng documentation: http://www.balabit.com/support/documentation/?product=syslog-ng
mailing list: https://lists.balabit.hu/mailman/listinfo/syslog-ng
/usr/local/etc/rc.d/syslog-ng: WARNING: failed to start syslog_ng

I have looked for a solution on the Internet and they say I need install the syslog-ng package with some kind of option to enable writing to MySQL. Is there a way to customise installation options when using pkg? (If no, why not?) Or do I have to install it through ports?
 
"Options" can be changed only when building/installing through ports, not by using the packages using pkg. This is because a "package" is pre-compiled port built with a fixed set of options, and pkg just puts those pre-compiled pieces on your system in the proper place; it doesn't build anything while installing.

From what I understand, there is work being done so that some day you will be able to say "I want the pre-built syslog-ng package installed that has options A, B and D enabled", but that's not available yet.
 
Options are set at the time a package is built. The extra features available to an application are often hard-coded into that application, so they need to be set before the application is compiled.

Well, thank you for the concise answers. But why isn't the all-important SQL support built into the default installation of syslog-ng anyway? Where do I apply for that? Wouldn't it also be cool to let the user decide with what options to install the package? (Or just install everything and not make us worry about what functionality is installed?)
 
But why isn't the all-important SQL support built into the default installation of syslog-ng anyway?
Because most syslog-ng users don't need it.

Wouldn't it also be cool to let the user decide with what options to install the package?
Packages are always built using the default settings. If you want or need to deviate from the defaults you'll have to build from ports or set up your own package repository using ports-mgmt/poudriere or ports-mgmt/synth.

(Or just install everything and not make us worry about what functionality is installed?)
Why add unneeded dependencies people rarely use? Why increase complexity when the simplest options are what most people need? And if you need them you can always enable them by building from ports, so why install them by default?
 
Binary packages are just simple tarballs with some amount "intelligence" for performing custom actions at installation time such as creating directories that are not covered by the pkg-plist or adding users/groups to the system. Excluding parts of the package or changing what gets installed based on user selected options at installation time is not implemented.
 
Back
Top