Other formats |
Share

7.8. Posting messages over HTTP without Java

Version 3.8 of syslog-ng OSE can directly post log messages to web services using the HTTP protocol, without having to use Java. The current implementation has the following limitations:

  • Only HTTP connections are supported, HTTPS is not.

  • Only the PUT and the POST methods are supported.

Declaration: 

destination d_http {
    http(
        url("http://127.0.0.1:8000")
        method("PUT")
        user_agent("syslog-ng User Agent")
        user("user")
        password("password")
        headers("HEADER1: header1", "HEADER2: header2")
        body("${ISODATE} ${MSG}")
    );
};
Example 7.18. Sending log data to a web service

The following example defines an http destination.

destination d_http {
    http(url("http://127.0.0.1:8000")
        method("PUT")
        user_agent("syslog-ng User Agent")
        user("user")
        password("password")
        headers("HEADER1: header1", "HEADER2: header2")
        body("${ISODATE} ${MSG}")
    );
};

log
    { source(s_file); destination(d_http); flags(flow-control); };