Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for verification #31

Merged
merged 3 commits into from Sep 2, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -41,8 +41,8 @@
NON_ROOT_USER = 2

MINIMUM_SUPPORTED_PYTHON_VERSION = '2.6'
VERIFICATION_SLEEP_INTERAVAL = 25
VERIFICATION_SLEEP_INTERAVAL_PER_ITERATION = 5
VERIFICATION_SLEEP_INTERVAL = 240
VERIFICATION_SLEEP_INTERVAL_PER_ITERATION = 5

OS_UBUNTU = 1
OS_FEDORA = 2
@@ -119,7 +119,7 @@
%s
template LogglyFormat { template("<${PRI}>1 ${ISODATE} ${HOST} ${PROGRAM} \
${PID} ${MSGID} [%s@%s] $MSG\\n");};
${PID} ${MSGID} [%s@%s tag=\\"example\\"] $MSG\\n");};
destination d_loggly {tcp("%s" port(%s) template(LogglyFormat));};
log { source(%s); destination(d_loggly); };
@@ -136,7 +136,7 @@
# Define the template used for sending logs to Loggly. Do not change this format.
$template LogglyFormat,"<%%pri%%>%%protocol-version%% %%timestamp:::date-rfc3339%% \
%%HOSTNAME%% %%app-name%% %%procid%% %%msgid%% [%s@%s] %%msg%%"
%%HOSTNAME%% %%app-name%% %%procid%% %%msgid%% [%s@%s tag=\\"example\\"] %%msg%%"
# Send messages to syslog server listening on TCP port using template
*.* @@%s:%s;LogglyFormat
@@ -1144,7 +1144,10 @@ def doverify(loggly_user, loggly_password, loggly_subdomain):
search_url = REST_URL_GET_SEARCH_ID % (loggly_subdomain, LOGGLY_DOMAIN, unique_string)
# Implement REST APIs to search if dummy message has been sent.
wait_time = 0
while wait_time < VERIFICATION_SLEEP_INTERAVAL:
while wait_time < VERIFICATION_SLEEP_INTERVAL:
print ".",
sys.stdout.flush()

Logger.printLog("Sending search request. %s" % search_url)
data = get_json_data(search_url, loggly_user, loggly_password)
rsid = data["rsid"]["id"]
@@ -1153,13 +1156,15 @@ def doverify(loggly_user, loggly_password, loggly_subdomain):
data = get_json_data(search_result_url, loggly_user, loggly_password)
total_events = data["total_events"]
if total_events >= 1 and VERIFICATION_FAIL not in LOGGLY_QA:
print "."
Logger.printLog(("******* Congratulations! "
"Loggly is configured successfully."),
print_comp = True)
break
wait_time += VERIFICATION_SLEEP_INTERAVAL_PER_ITERATION
time.sleep(VERIFICATION_SLEEP_INTERAVAL_PER_ITERATION)
if wait_time >= VERIFICATION_SLEEP_INTERAVAL:
wait_time += VERIFICATION_SLEEP_INTERVAL_PER_ITERATION
time.sleep(VERIFICATION_SLEEP_INTERVAL_PER_ITERATION)

if wait_time >= VERIFICATION_SLEEP_INTERVAL:
Logger.printLog(VERIFICATION_FAIL_MESSAGE,
prio = 'crit', print_comp = True)

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.