summaryrefslogtreecommitdiff
path: root/app-admin/rsyslog/files
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-04-28 09:54:45 +0100
committerV3n3RiX <venerix@redcorelinux.org>2019-04-28 09:54:45 +0100
commitb7ebc951da8800f711142f69d9d958bde67a112d (patch)
treee318514216845acb8f2e49fff7a5cba4027e9d91 /app-admin/rsyslog/files
parentdc7cbdfa65fd814b3b9aa3c56257da201109e807 (diff)
gentoo resync : 28.04.2019
Diffstat (limited to 'app-admin/rsyslog/files')
-rw-r--r--app-admin/rsyslog/files/rsyslog-8.1903.0-add-missing-tests.patch736
-rw-r--r--app-admin/rsyslog/files/rsyslog-8.1903.0-add-py3-support-to-omhttp-test.patch83
-rw-r--r--app-admin/rsyslog/files/rsyslog-8.1903.0-fix-py3-compatibility-in-diag.sh.patch22
3 files changed, 841 insertions, 0 deletions
diff --git a/app-admin/rsyslog/files/rsyslog-8.1903.0-add-missing-tests.patch b/app-admin/rsyslog/files/rsyslog-8.1903.0-add-missing-tests.patch
new file mode 100644
index 000000000000..da9c79c68293
--- /dev/null
+++ b/app-admin/rsyslog/files/rsyslog-8.1903.0-add-missing-tests.patch
@@ -0,0 +1,736 @@
+--- /dev/null
++++ b/tests/omhttp-auth-vg.sh
+@@ -0,0 +1,3 @@
++#!/bin/bash
++export USE_VALGRIND="YES"
++source ${srcdir:=.}/omhttp-auth.sh
+--- /dev/null
++++ b/tests/omhttp-auth.sh
+@@ -0,0 +1,45 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++export NUMMESSAGES=100
++
++port="$(get_free_port)"
++omhttp_start_server $port --userpwd="bob:bobbackwards"
++
++generate_conf
++add_conf '
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++module(load="../contrib/omhttp/.libs/omhttp")
++
++if $msg contains "msgnum:" then
++ action(
++ # Payload
++ name="my_http_action"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="off"
++
++ # Auth
++ usehttps="off"
++ uid="bob"
++ pwd="bobbackwards"
++ )
++'
++startup
++injectmsg
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint
++omhttp_stop_server
++seq_check
++exit_test
+--- /dev/null
++++ b/tests/omhttp-basic-vg.sh
+@@ -0,0 +1,3 @@
++#!/bin/bash
++export USE_VALGRIND="YES"
++source ${srcdir:=.}/omhttp-basic.sh
+--- /dev/null
++++ b/tests/omhttp-basic.sh
+@@ -0,0 +1,43 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++export NUMMESSAGES=10000
++
++port="$(get_free_port)"
++omhttp_start_server $port
++
++generate_conf
++add_conf '
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++module(load="../contrib/omhttp/.libs/omhttp")
++
++if $msg contains "msgnum:" then
++ action(
++ # Payload
++ name="my_http_action"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="off"
++
++ # Auth
++ usehttps="off"
++ )
++'
++startup
++injectmsg
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint
++omhttp_stop_server
++seq_check
++exit_test
+--- /dev/null
++++ b/tests/omhttp-batch-fail-with-400.sh
+@@ -0,0 +1,52 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++port="$(get_free_port)"
++omhttp_start_server $port --fail-with-400-after 1000
++
++generate_conf
++add_conf '
++module(load="../contrib/omhttp/.libs/omhttp")
++
++main_queue(queue.dequeueBatchSize="2048")
++
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++# Wrap message as a single batch for retry
++template(name="tpl_retry" type="string" string="[%msg%]")
++
++
++ruleset(name="ruleset_omhttp") {
++ action(
++ name="action_omhttp"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="off"
++
++ retry="on"
++
++ # Auth
++ usehttps="off"
++ ) & stop
++}
++
++if $msg contains "msgnum:" then
++ call ruleset_omhttp
++'
++startup
++injectmsg 0 10000
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint
++omhttp_stop_server
++seq_check 0 999
++exit_test
+--- /dev/null
++++ b/tests/omhttp-batch-jsonarray-compress-vg.sh
+@@ -0,0 +1,3 @@
++#!/bin/bash
++export USE_VALGRIND="YES"
++source ${srcdir:=.}/omhttp-batch-jsonarray-compress.sh
+--- /dev/null
++++ b/tests/omhttp-batch-jsonarray-compress.sh
+@@ -0,0 +1,48 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++export NUMMESSAGES=50000
++
++port="$(get_free_port)"
++omhttp_start_server $port --decompress
++
++generate_conf
++add_conf '
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++module(load="../contrib/omhttp/.libs/omhttp")
++
++main_queue(queue.dequeueBatchSize="2048")
++
++if $msg contains "msgnum:" then
++ action(
++ # Payload
++ name="my_http_action"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="on"
++ batch.format="jsonarray"
++ batch.maxsize="1000"
++ compress="on"
++
++ # Auth
++ usehttps="off"
++ )
++'
++startup
++injectmsg
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint jsonarray
++omhttp_stop_server
++seq_check
++exit_test
+--- /dev/null
++++ b/tests/omhttp-batch-jsonarray-retry-vg.sh
+@@ -0,0 +1,3 @@
++#!/bin/bash
++export USE_VALGRIND="YES"
++source ${srcdir:=.}/omhttp-batch-jsonarray-retry.sh
+--- /dev/null
++++ b/tests/omhttp-batch-jsonarray-retry.sh
+@@ -0,0 +1,78 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++export NUMMESSAGES=50000
++
++port="$(get_free_port)"
++omhttp_start_server $port --fail-every 100
++
++generate_conf
++add_conf '
++module(load="../contrib/omhttp/.libs/omhttp")
++
++main_queue(queue.dequeueBatchSize="2048")
++
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++# Echo message as-is for retry
++template(name="tpl_echo" type="string" string="%msg%")
++
++ruleset(name="ruleset_omhttp_retry") {
++ action(
++ name="action_omhttp"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl_echo"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="on"
++ batch.maxsize="100"
++ batch.format="jsonarray"
++
++ retry="on"
++ retry.ruleset="ruleset_omhttp_retry"
++
++ # Auth
++ usehttps="off"
++ ) & stop
++}
++
++ruleset(name="ruleset_omhttp") {
++ action(
++ name="action_omhttp"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="on"
++ batch.maxsize="100"
++ batch.format="jsonarray"
++
++ retry="on"
++ retry.ruleset="ruleset_omhttp_retry"
++
++ # Auth
++ usehttps="off"
++ ) & stop
++}
++
++if $msg contains "msgnum:" then
++ call ruleset_omhttp
++'
++startup
++injectmsg
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint jsonarray
++omhttp_stop_server
++seq_check
++exit_test
+--- /dev/null
++++ b/tests/omhttp-batch-jsonarray-vg.sh
+@@ -0,0 +1,3 @@
++#!/bin/bash
++export USE_VALGRIND="YES"
++source ${srcdir:=.}/omhttp-batch-jsonarray.sh
+--- /dev/null
++++ b/tests/omhttp-batch-jsonarray.sh
+@@ -0,0 +1,47 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++export NUMMESSAGES=50000
++
++port="$(get_free_port)"
++omhttp_start_server $port
++
++generate_conf
++add_conf '
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++module(load="../contrib/omhttp/.libs/omhttp")
++
++main_queue(queue.dequeueBatchSize="2048")
++
++if $msg contains "msgnum:" then
++ action(
++ # Payload
++ name="my_http_action"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="on"
++ batch.format="jsonarray"
++ batch.maxsize="1000"
++
++ # Auth
++ usehttps="off"
++ )
++'
++startup
++injectmsg
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint jsonarray
++omhttp_stop_server
++seq_check
++exit_test
+--- /dev/null
++++ b/tests/omhttp-batch-kafkarest-retry-vg.sh
+@@ -0,0 +1,3 @@
++#!/bin/bash
++export USE_VALGRIND="YES"
++source ${srcdir:=.}/omhttp-batch-kafkarest-retry.sh
+--- /dev/null
++++ b/tests/omhttp-batch-kafkarest-retry.sh
+@@ -0,0 +1,78 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++export NUMMESSAGES=50000
++
++port="$(get_free_port)"
++omhttp_start_server $port --fail-every 100
++
++generate_conf
++add_conf '
++module(load="../contrib/omhttp/.libs/omhttp")
++
++main_queue(queue.dequeueBatchSize="2048")
++
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++# Echo message as-is for retry
++template(name="tpl_echo" type="string" string="%msg%")
++
++ruleset(name="ruleset_omhttp_retry") {
++ action(
++ name="action_omhttp"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl_echo"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="on"
++ batch.maxsize="100"
++ batch.format="kafkarest"
++
++ retry="on"
++ retry.ruleset="ruleset_omhttp_retry"
++
++ # Auth
++ usehttps="off"
++ ) & stop
++}
++
++ruleset(name="ruleset_omhttp") {
++ action(
++ name="action_omhttp"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="on"
++ batch.maxsize="100"
++ batch.format="kafkarest"
++
++ retry="on"
++ retry.ruleset="ruleset_omhttp_retry"
++
++ # Auth
++ usehttps="off"
++ ) & stop
++}
++
++if $msg contains "msgnum:" then
++ call ruleset_omhttp
++'
++startup
++injectmsg
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint kafkarest
++omhttp_stop_server
++seq_check
++exit_test
+--- /dev/null
++++ b/tests/omhttp-batch-kafkarest.sh
+@@ -0,0 +1,47 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++export NUMMESSAGES=50000
++
++port="$(get_free_port)"
++omhttp_start_server $port
++
++generate_conf
++add_conf '
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++module(load="../contrib/omhttp/.libs/omhttp")
++
++main_queue(queue.dequeueBatchSize="2048")
++
++if $msg contains "msgnum:" then
++ action(
++ # Payload
++ name="my_http_action"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="on"
++ batch.format="kafkarest"
++ batch.maxsize="100"
++
++ # Auth
++ usehttps="off"
++ )
++'
++startup
++injectmsg
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint kafkarest
++omhttp_stop_server
++seq_check
++exit_test
+--- /dev/null
++++ b/tests/omhttp-batch-newline.sh
+@@ -0,0 +1,47 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++export NUMMESSAGES=50000
++
++port="$(get_free_port)"
++omhttp_start_server $port
++
++generate_conf
++add_conf '
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++module(load="../contrib/omhttp/.libs/omhttp")
++
++main_queue(queue.dequeueBatchSize="2048")
++
++if $msg contains "msgnum:" then
++ action(
++ # Payload
++ name="my_http_action"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="on"
++ batch.format="newline"
++ batch.maxsize="100"
++
++ # Auth
++ usehttps="off"
++ )
++'
++startup
++injectmsg
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint newline
++omhttp_stop_server
++seq_check
++exit_test
+--- /dev/null
++++ b/tests/omhttp-retry-vg.sh
+@@ -0,0 +1,3 @@
++#!/bin/bash
++export USE_VALGRIND="YES"
++source ${srcdir:=.}/omhttp-retry.sh
+--- /dev/null
++++ b/tests/omhttp-retry.sh
+@@ -0,0 +1,46 @@
++#!/bin/bash
++# This file is part of the rsyslog project, released under ASL 2.0
++
++# Starting actual testbench
++. ${srcdir:=.}/diag.sh init
++
++export NUMMESSAGES=10000
++
++port="$(get_free_port)"
++omhttp_start_server $port --fail-every 1000
++
++generate_conf
++add_conf '
++module(load="../contrib/omhttp/.libs/omhttp")
++
++main_queue(queue.dequeueBatchSize="2048")
++
++template(name="tpl" type="string"
++ string="{\"msgnum\":\"%msg:F,58:2%\"}")
++
++if $msg contains "msgnum:" then
++ action(
++ # Payload
++ action.resumeRetryCount="-1"
++ name="my_http_action"
++ type="omhttp"
++ errorfile="'$RSYSLOG_DYNNAME/omhttp.error.log'"
++ template="tpl"
++
++ server="localhost"
++ serverport="'$port'"
++ restpath="my/endpoint"
++ batch="off"
++
++ # Auth
++ usehttps="off"
++ )
++'
++startup
++injectmsg
++shutdown_when_empty
++wait_shutdown
++omhttp_get_data $port my/endpoint
++omhttp_stop_server
++seq_check
++exit_test
+--- /dev/null
++++ b/tests/omhttp_server.py
+@@ -0,0 +1,130 @@
++#!/usr/bin/env python
++
++import argparse
++import json
++import os
++import zlib
++import base64
++
++try:
++ from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer # Python 2
++except ImportError:
++ from http.server import BaseHTTPRequestHandler, HTTPServer # Python 3
++
++# Keep track of data received at each path
++data = {}
++
++metadata = {'posts': 0, 'fail_after': 0, 'fail_every': -1, 'decompress': False, 'userpwd': ''}
++
++
++class MyHandler(BaseHTTPRequestHandler):
++ """
++ POST'd data is kept in the data global dict.
++ Keys are the path, values are the raw received data.
++ Two post requests to <host>:<port>/post/endpoint means data looks like...
++ {"/post/endpoint": ["{\"msgnum\":\"00001\"}", "{\"msgnum\":\"00001\"}"]}
++
++ GET requests return all data posted to that endpoint as a json list.
++ Note that rsyslog usually sends escaped json data, so some parsing may be needed.
++ A get request for <host>:<post>/post/endpoint responds with...
++ ["{\"msgnum\":\"00001\"}", "{\"msgnum\":\"00001\"}"]
++ """
++
++ def validate_auth(self):
++ # header format for basic authentication
++ # 'Authorization: Basic <base 64 encoded uid:pwd>'
++ if 'Authorization' not in self.headers:
++ self.send_response(401)
++ self.end_headers()
++ self.wfile.write('missing "Authorization" header')
++ return False
++
++ auth_header = self.headers['Authorization']
++ _, b64userpwd = auth_header.split()
++ userpwd = base64.b64decode(b64userpwd)
++ if userpwd != metadata['userpwd']:
++ self.send_response(401)
++ self.end_headers()
++ self.wfile.write('invalid auth: {0}'.format(userpwd))
++ return False
++
++ return True
++
++ def do_POST(self):
++ metadata['posts'] += 1
++
++ if metadata['userpwd']:
++ if not self.validate_auth():
++ return
++
++ if metadata['fail_with_400_after'] != -1 and metadata['posts'] > metadata['fail_with_400_after']:
++ self.send_response(400)
++ self.end_headers()
++ self.wfile.write('BAD REQUEST')
++ return
++
++ if metadata['posts'] > 1 and metadata['fail_every'] != -1 and metadata['posts'] % metadata['fail_every'] == 0:
++ self.send_response(500)
++ self.end_headers()
++ self.wfile.write('INTERNAL ERROR')
++ return
++
++ content_length = int(self.headers['Content-Length'])
++ raw_data = self.rfile.read(content_length)
++
++ if metadata['decompress']:
++ post_data = zlib.decompress(raw_data, 31)
++ else:
++ post_data = raw_data
++
++ if self.path not in data:
++ data[self.path] = []
++ data[self.path].append(post_data)
++
++ res = json.dumps({'msg': 'ok'})
++
++ self.send_response(200)
++ self.send_header('Content-Type', 'application/json')
++ self.send_header('Content-Length', len(res))
++ self.end_headers()
++
++ self.wfile.write(res)
++ return
++
++ def do_GET(self):
++ if self.path in data:
++ result = data[self.path]
++ else:
++ result = []
++
++ res = json.dumps(result)
++
++ self.send_response(200)
++ self.send_header('Content-Type', 'application/json')
++ self.send_header('Content-Length', len(res))
++ self.end_headers()
++
++ self.wfile.write(res)
++ return
++
++
++if __name__ == '__main__':
++ parser = argparse.ArgumentParser(description='Archive and delete core app log files')
++ parser.add_argument('-p', '--port', action='store', type=int, default=8080, help='port')
++ parser.add_argument('-i', '--interface', action='store', type=str, default='localhost', help='port')
++ parser.add_argument('--fail-after', action='store', type=int, default=0, help='start failing after n posts')
++ parser.add_argument('--fail-every', action='store', type=int, default=-1, help='fail every n posts')
++ parser.add_argument('--fail-with-400-after', action='store', type=int, default=-1, help='fail with 400 after n posts')
++ parser.add_argument('--decompress', action='store_true', default=False, help='decompress posted data')
++ parser.add_argument('--userpwd', action='store', default='', help='only accept this user:password combination')
++ args = parser.parse_args()
++ metadata['fail_after'] = args.fail_after
++ metadata['fail_every'] = args.fail_every
++ metadata['fail_with_400_after'] = args.fail_with_400_after
++ metadata['decompress'] = args.decompress
++ metadata['userpwd'] = args.userpwd
++ server = HTTPServer((args.interface, args.port), MyHandler)
++ pid = os.getpid()
++ print('starting omhttp test server at {interface}:{port} with pid {pid}'
++ .format(interface=args.interface, port=args.port, pid=pid))
++ server.serve_forever()
diff --git a/app-admin/rsyslog/files/rsyslog-8.1903.0-add-py3-support-to-omhttp-test.patch b/app-admin/rsyslog/files/rsyslog-8.1903.0-add-py3-support-to-omhttp-test.patch
new file mode 100644
index 000000000000..6600c61666e9
--- /dev/null
+++ b/app-admin/rsyslog/files/rsyslog-8.1903.0-add-py3-support-to-omhttp-test.patch
@@ -0,0 +1,83 @@
+From c82b747eaf96cc77efa530ca5844ba01b91bfc88 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@whissi.de>
+Date: Sat, 6 Apr 2019 00:28:54 +0200
+Subject: [PATCH] tests: omhttp: add Python 3 compatibility
+
+Fixes: https://github.com/rsyslog/rsyslog/issues/3599
+---
+ tests/omhttp_server.py | 22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/tests/omhttp_server.py b/tests/omhttp_server.py
+index 6962138fa..d3fdb3a9a 100644
+--- a/tests/omhttp_server.py
++++ b/tests/omhttp_server.py
+@@ -36,16 +36,16 @@ def validate_auth(self):
+ if 'Authorization' not in self.headers:
+ self.send_response(401)
+ self.end_headers()
+- self.wfile.write('missing "Authorization" header')
++ self.wfile.write(b'missing "Authorization" header')
+ return False
+
+ auth_header = self.headers['Authorization']
+ _, b64userpwd = auth_header.split()
+- userpwd = base64.b64decode(b64userpwd)
++ userpwd = base64.b64decode(b64userpwd).decode('utf-8')
+ if userpwd != metadata['userpwd']:
+ self.send_response(401)
+ self.end_headers()
+- self.wfile.write('invalid auth: {0}'.format(userpwd))
++ self.wfile.write(b'invalid auth: {0}'.format(userpwd))
+ return False
+
+ return True
+@@ -60,16 +60,16 @@ def do_POST(self):
+ if metadata['fail_with_400_after'] != -1 and metadata['posts'] > metadata['fail_with_400_after']:
+ self.send_response(400)
+ self.end_headers()
+- self.wfile.write('BAD REQUEST')
++ self.wfile.write(b'BAD REQUEST')
+ return
+
+ if metadata['posts'] > 1 and metadata['fail_every'] != -1 and metadata['posts'] % metadata['fail_every'] == 0:
+ self.send_response(500)
+ self.end_headers()
+- self.wfile.write('INTERNAL ERROR')
++ self.wfile.write(b'INTERNAL ERROR')
+ return
+
+- content_length = int(self.headers['Content-Length'])
++ content_length = int(self.headers['Content-Length'] or 0)
+ raw_data = self.rfile.read(content_length)
+
+ if metadata['decompress']:
+@@ -79,12 +79,12 @@ def do_POST(self):
+
+ if self.path not in data:
+ data[self.path] = []
+- data[self.path].append(post_data)
++ data[self.path].append(post_data.decode('utf-8'))
+
+- res = json.dumps({'msg': 'ok'})
++ res = json.dumps({'msg': 'ok'}).encode('utf8')
+
+ self.send_response(200)
+- self.send_header('Content-Type', 'application/json')
++ self.send_header('Content-Type', 'application/json; charset=utf-8')
+ self.send_header('Content-Length', len(res))
+ self.end_headers()
+
+@@ -97,10 +97,10 @@ def do_GET(self):
+ else:
+ result = []
+
+- res = json.dumps(result)
++ res = json.dumps(result).encode('utf8')
+
+ self.send_response(200)
+- self.send_header('Content-Type', 'application/json')
++ self.send_header('Content-Type', 'application/json; charset=utf-8')
+ self.send_header('Content-Length', len(res))
+ self.end_headers()
+
diff --git a/app-admin/rsyslog/files/rsyslog-8.1903.0-fix-py3-compatibility-in-diag.sh.patch b/app-admin/rsyslog/files/rsyslog-8.1903.0-fix-py3-compatibility-in-diag.sh.patch
new file mode 100644
index 000000000000..615bb50bdb92
--- /dev/null
+++ b/app-admin/rsyslog/files/rsyslog-8.1903.0-fix-py3-compatibility-in-diag.sh.patch
@@ -0,0 +1,22 @@
+From f0847e46c148233b6ab5d6088ca4e1dc664e82a4 Mon Sep 17 00:00:00 2001
+From: Thomas Deutschmann <whissi@whissi.de>
+Date: Sat, 6 Apr 2019 02:07:51 +0200
+Subject: [PATCH] testbench: fix Python 3 compatibility
+
+---
+ tests/diag.sh | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/diag.sh b/tests/diag.sh
+index 5b4b3df46..2926e6ac2 100755
+--- a/tests/diag.sh
++++ b/tests/diag.sh
+@@ -1334,7 +1334,7 @@ get_inode() {
+ printf 'FAIL: file "%s" does not exist in get_inode\n' "$1"
+ error_exit 100
+ fi
+- python -c 'import os; import stat; print os.lstat("'$1'")[stat.ST_INO]'
++ python -c 'import os; import stat; print(os.lstat("'$1'")[stat.ST_INO])'
+ }
+
+