Syslog NG - MacOS Testing
  • GSOC - Project Report
  • Testing Methodology
  • Testing Status
  • Installation
  • Modules
    • afsocket [17]
      • network() Source Driver
      • network() Destination Driver
      • syslog() Source/Destination Driver
      • unix-stream() Source Driver
      • unix-stream() Destination Driver
      • unix-dgram() Source/Destination Driver
      • TLS-Encryption
        • Using network()
        • Using syslog()
    • affile [6]
      • file() Source Driver
      • file() Destination Driver
      • pipe() Source Driver
      • pipe() Destination Driver
      • wildcard_file() Source Driver
      • stdin() Source Driver
    • afprog [2]
      • program() Source Driver
      • program() Destination Driver
    • system [1]
      • Collecting local logs pre macOS 10.15 Catalina
    • afuser [1]
    • pseudofile [1]
    • mod-python [7]
      • python() Source Driver
      • python-fetcher() Source Driver
      • python() Destination Driver*
    • afmongodb [1]
    • http [1]
    • riemann [1]
    • redis [1]
    • elasticsearch-http [1]
    • afsql [1]
    • afsmtp [1]
Powered by GitBook
On this page
  • Important Information
  • Status
  • Testing
  • Proof

Was this helpful?

  1. Modules

http [1]

The http module has only one driver, which is the http() destination driver. The http() driver sends messages to web services using HTTP protocol.

Important Information

  • Error and status messages received from the HTTP server are forwarded to the internal logs of syslog-ng.

  • Only HTTP connections are supported, HTTPS is not.

  • This implementation does not require Java.

  • Only the PUT and the POST methods are supported. For more methods, Java is required which will be covered in the Java driver post.

Status

Architecture

Status

x86

Works

ARM

Works

Testing

To test the HTTP destination driver, we need to be able to send the data to a host that can accept the PUT/POST methods and display confirmation of the same. A dummy server python script is shown below to achieve the same. To test this, we will send a PUT/POST request from our syslog-ng to the dummy server we set up and look for the output of the server.

Server code ( python3 )

from http.server import HTTPServer, BaseHTTPRequestHandler

class S(BaseHTTPRequestHandler):
    def _set_headers(self):
        self.send_response(200)
        self.send_header("Content-type", "text/html")
        self.end_headers()

    def do_POST(self):
        content_length = int(self.headers['Content-Length']) # <--- Gets the size of data
        post_data = self.rfile.read(content_length) # <--- Gets the data itself
        print(post_data)
        self._set_headers()

def run(server_class=HTTPServer, handler_class=S, addr="localhost", port=8000):
    server_address = (addr, port)
    httpd = server_class(server_address, handler_class)
    print(f"Starting httpd server on {addr}:{port}")
    httpd.serve_forever()

run()

Configuration file used

@version: 3.31
@include "scl.conf"

options {
    stats-freq(10);
    time-reopen(10);
};

source custom
{
    example-msg-generator(
        num(20)
        freq(5)
        template("HTTP Message")
    );
};

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

log {
    source(custom);
    destination(d_http);
};

Proof

Previousafmongodb [1]Nextriemann [1]

Last updated 3 years ago

Was this helpful?

http() destination driver tested on macOS (x86)
http() destination driver tested on macOS (ARM)