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
=== modified file 'cd.py'
--- cd.py 2015-08-27 21:27:50 +0000
+++ cd.py 2015-09-01 02:29:45 +0000
@@ -19,7 +19,6 @@
19"""CI Automation: mojo spec (branch & stage) watcher."""19"""CI Automation: mojo spec (branch & stage) watcher."""
2020
21import argparse21import argparse
22import logging
23import os22import os
24import os.path23import os.path
25import sys24import sys
@@ -69,7 +68,9 @@
69 '--stage', args.stage68 '--stage', args.stage
70 ])69 ])
7170
72 logger = setup_logger()71 # Thomi - 2015-09-01: set this to True (and delete this comment) once we
72 # know that TCP/IP based logstash works well.
73 logger = setup_logger(use_tcp=False)
7374
74 # Deploy new environment if the stage identifier isn't recorded.75 # Deploy new environment if the stage identifier isn't recorded.
75 idenfifier_dir = os.path.expanduser('~/ci-cd-identifiers/')76 idenfifier_dir = os.path.expanduser('~/ci-cd-identifiers/')
7677
=== modified file 'ci_automation/utils.py'
--- ci_automation/utils.py 2015-08-14 19:06:02 +0000
+++ ci_automation/utils.py 2015-09-01 02:29:45 +0000
@@ -65,7 +65,7 @@
65 )65 )
6666
6767
68def setup_logger():68def setup_logger(use_tcp=False):
69 """Return a configured logger instance.69 """Return a configured logger instance.
7070
71 Defaults to INFO level and if 'CI_LOGSTASH_HOST' environment variable71 Defaults to INFO level and if 'CI_LOGSTASH_HOST' environment variable
@@ -85,9 +85,15 @@
85 except ImportError:85 except ImportError:
86 print('Follow the README instructions for installing '86 print('Follow the README instructions for installing '
87 'python-logstash')87 'python-logstash')
88 return 188 return logger
89 else:89 else:
90 logger.addHandler(90 if use_tcp:
91 logstash.LogstashHandler(logstash_host, 5959, version=1))91 logger.addHandler(
92 logstash.TCPLogstashHandler(logstash_host, 5959, version=1)
93 )
94 else:
95 logger.addHandler(
96 logstash.LogstashHandler(logstash_host, 5959, version=1)
97 )
9298
93 return logger99 return logger
94100
=== modified file 'log.py'
--- log.py 2015-08-20 16:35:17 +0000
+++ log.py 2015-09-01 02:29:45 +0000
@@ -18,22 +18,19 @@
18"""CI Automation: tool for monitoring rabbitmq queue information."""18"""CI Automation: tool for monitoring rabbitmq queue information."""
1919
20import argparse20import argparse
21import json
22import os
23import subprocess
2421
25from ci_automation.utils import setup_logger22from ci_automation.utils import setup_logger
2623
2724
28
29def main():25def main():
30 parser = argparse.ArgumentParser(26 parser = argparse.ArgumentParser(
31 description="Log messages to logstash ...")27 description="Log messages to logstash ...")
32 parser.add_argument('--error', action="store_true", default=False)28 parser.add_argument('--error', action="store_true", default=False)
29 parser.add_argument('--tcp', action="store_true", default=False)
33 parser.add_argument('text', metavar="TEXT", help="text to log")30 parser.add_argument('text', metavar="TEXT", help="text to log")
3431
35 args = parser.parse_args()32 args = parser.parse_args()
36 logger = setup_logger()33 logger = setup_logger(use_tcp=args.tcp)
3734
38 extra = {35 extra = {
39 'solution': 'spi',36 'solution': 'spi',

Subscribers

People subscribed via source and target branches

to all changes: