Running the Sample Table UDF in apache_log_reader.cxx

The sample apache_log_reader is included in a precompiled dynamic library called libv4apiex (extension is platform-dependent). Its implementation is in the samples directory in apache_log_reader.cxx.

  1. To declare the table UDF to the server, issue:
    create procedure apache_log_reader
    (
        in file_name  varchar(4000),
        in log_format varchar(32),
        in ip_padding varchar(1)
    )
    result
    (
        ip_address  varchar(15),
        log_name    varchar(4000),
        user_name   varchar(4000),
        access_time datetime,
        time_zone   int,
        request     varchar(4000),
        response    int,
        bytes_sent  int,
        referer     varchar(4000),
        browser     varchar(4000),
        error_type  varchar(4000),
        error_msg   varchar(4000)
    )
    external name 'apache_log_reader@libv4apiex'
  2. Select rows from the table UDF. Use the full path to the access log when executing the SQL query.
    SELECT * FROM apache_log_reader( 'apache_access.log', 'access', null );