Merge lp:~thomir-deactivatedaccount/tanuki-continuous-deployer/trunk-use-tcp-logstash into lp:tanuki-continuous-deployer

Proposed by Thomi Richards
Status: Merged
Approved by: Celso Providelo
Approved revision: 17
Merged at revision: 16
Proposed branch: lp:~thomir-deactivatedaccount/tanuki-continuous-deployer/trunk-use-tcp-logstash
Merge into: lp:tanuki-continuous-deployer
Diff against target: 83 lines (+15/-11)
3 files modified
cd.py (+3/-2)
ci_automation/utils.py (+10/-4)
log.py (+2/-5)
To merge this branch: bzr merge lp:~thomir-deactivatedaccount/tanuki-continuous-deployer/trunk-use-tcp-logstash
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+269688@code.launchpad.net

Commit message

Use the TCP logstash logging handler.

Description of the change

Use the TCP logstash logging handler.

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) wrote :

Thomi,

Thanks for preparing the terrain for TCP transport.

I want to continue to use log.py to test UDP transport, as our services. Can you add a option to setup_logging() ?

review: Needs Information
17. By Thomi Richards

Add support for TCP/IP-based logging to log.py.

Revision history for this message
Celso Providelo (cprov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cd.py'
2--- cd.py 2015-08-27 21:27:50 +0000
3+++ cd.py 2015-09-01 02:29:45 +0000
4@@ -19,7 +19,6 @@
5 """CI Automation: mojo spec (branch & stage) watcher."""
6
7 import argparse
8-import logging
9 import os
10 import os.path
11 import sys
12@@ -69,7 +68,9 @@
13 '--stage', args.stage
14 ])
15
16- logger = setup_logger()
17+ # Thomi - 2015-09-01: set this to True (and delete this comment) once we
18+ # know that TCP/IP based logstash works well.
19+ logger = setup_logger(use_tcp=False)
20
21 # Deploy new environment if the stage identifier isn't recorded.
22 idenfifier_dir = os.path.expanduser('~/ci-cd-identifiers/')
23
24=== modified file 'ci_automation/utils.py'
25--- ci_automation/utils.py 2015-08-14 19:06:02 +0000
26+++ ci_automation/utils.py 2015-09-01 02:29:45 +0000
27@@ -65,7 +65,7 @@
28 )
29
30
31-def setup_logger():
32+def setup_logger(use_tcp=False):
33 """Return a configured logger instance.
34
35 Defaults to INFO level and if 'CI_LOGSTASH_HOST' environment variable
36@@ -85,9 +85,15 @@
37 except ImportError:
38 print('Follow the README instructions for installing '
39 'python-logstash')
40- return 1
41+ return logger
42 else:
43- logger.addHandler(
44- logstash.LogstashHandler(logstash_host, 5959, version=1))
45+ if use_tcp:
46+ logger.addHandler(
47+ logstash.TCPLogstashHandler(logstash_host, 5959, version=1)
48+ )
49+ else:
50+ logger.addHandler(
51+ logstash.LogstashHandler(logstash_host, 5959, version=1)
52+ )
53
54 return logger
55
56=== modified file 'log.py'
57--- log.py 2015-08-20 16:35:17 +0000
58+++ log.py 2015-09-01 02:29:45 +0000
59@@ -18,22 +18,19 @@
60 """CI Automation: tool for monitoring rabbitmq queue information."""
61
62 import argparse
63-import json
64-import os
65-import subprocess
66
67 from ci_automation.utils import setup_logger
68
69
70-
71 def main():
72 parser = argparse.ArgumentParser(
73 description="Log messages to logstash ...")
74 parser.add_argument('--error', action="store_true", default=False)
75+ parser.add_argument('--tcp', action="store_true", default=False)
76 parser.add_argument('text', metavar="TEXT", help="text to log")
77
78 args = parser.parse_args()
79- logger = setup_logger()
80+ logger = setup_logger(use_tcp=args.tcp)
81
82 extra = {
83 'solution': 'spi',

Subscribers

People subscribed via source and target branches

to all changes: