java: Post messages over HTTP using Java

Version 3.7 of AxoSyslog can directly post log messages to web services using the HTTP protocol. Error and status messages received from the HTTP server are forwarded to the internal logs of AxoSyslog. The current implementation has the following limitations:

Prerequisites

The Java HTTP module is no longer shipped with AxoSyslog: it isn’t part of the axosyslog-mod-java (Debian/Ubuntu) or axosyslog-java (RHEL and compatible distributions) package. Use the http: Post messages over HTTP without Java destination instead, which is available in the axosyslog-mod-http/axosyslog-http package.

Declaration:

Terminal window
   java(
        class-path("/syslog-ng/install_dir/lib/syslog-ng/java-modules/*.jar")
        class-name("org.syslog_ng.http.HTTPDestination")
    
        option("url", "http://<server-address>:<port-number>")
    
    );

Example: Sending log data to a web service

The following example defines an http destination.

Terminal window
   destination d_http {
        java(
            class-path("/syslog-ng/install_dir/lib/syslog-ng/java-modules/*.jar")
            class-name("org.syslog_ng.http.HTTPDestination")
    
            option("url", "http://192.168.1.1:80")
        );
    };
    
    log
        { source(s_file); destination(d_http); flags(flow-control); };