Skip to content

Commit a23cb27

Browse files
committed
Require path setting to the Sqlite database
As the previous default value ":memory:" doesn't work as expected because each connection opens a new database instance, make the database path setting required. Also, make the port setting required as it probably makes little sense to pick 5959 as default and so we can keep the argument order host, port. Fixes #5.
1 parent e8bc335 commit a23cb27

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

docs/config.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ host
88
The host of the Logstash server (no default)
99

1010
port
11-
The port of the Logstash server (default 5959)
11+
The port of the Logstash server (no default)
12+
13+
database_path
14+
The path to the file containing queued events (no default)
1215

1316
transport
1417
Callable or path to a compatible transport class
@@ -43,9 +46,6 @@ ca_certs
4346
(default: None)
4447
Only used for `logstash_async.transport.TcpTransport`.
4548

46-
database_path
47-
The path to the file containing queued events (default: ':memory:')
48-
4949
enable
5050
Flag to enable log processing (default is True, disabling
5151
might be handy for local testing, etc.)

logstash_async/handler.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,35 @@ class ProcessingError(Exception):
1818

1919
class AsynchronousLogstashHandler(Handler):
2020
"""Python logging handler for Logstash. Sends events over TCP.
21-
:param host: The host of the logstash server.
22-
:param port: The port of the logstash server (default 5959).
21+
:param host: The host of the logstash server, required.
22+
:param port: The port of the logstash server, required.
23+
:param database_path: The path to the file containing queued events, required.
2324
:param transport: Callable or path to a compatible transport class.
2425
:param ssl_enable: Should SSL be enabled for the connection? Default is False.
2526
:param ssl_verify: Should the server's SSL certificate be verified?
2627
:param keyfile: The path to client side SSL key file (default is None).
2728
:param certfile: The path to client side SSL certificate file (default is None).
2829
:param ca_certs: The path to the file containing recognized CA certificates.
29-
:param database_path: The path to the file containing queued events.
3030
:param enable Flag to enable log processing (default is True, disabling
3131
might be handy for local testing, etc.)
3232
"""
3333

3434
_worker_thread = None
3535

3636
# ----------------------------------------------------------------------
37-
def __init__(self, host, port=5959, transport='logstash_async.transport.TcpTransport',
37+
def __init__(self, host, port, database_path, transport='logstash_async.transport.TcpTransport',
3838
ssl_enable=False, ssl_verify=True, keyfile=None, certfile=None, ca_certs=None,
39-
database_path=':memory:', enable=True):
39+
enable=True):
4040
super(AsynchronousLogstashHandler, self).__init__()
4141
self._host = host
4242
self._port = port
43+
self._database_path = database_path
4344
self._transport_path = transport
4445
self._ssl_enable = ssl_enable
4546
self._ssl_verify = ssl_verify
4647
self._keyfile = keyfile
4748
self._certfile = certfile
4849
self._ca_certs = ca_certs
49-
self._database_path = database_path
5050
self._enable = enable
5151
self._transport = None
5252
self._setup_transport()

0 commit comments

Comments
 (0)