Skip to content

Instantly share code, notes, and snippets.

@dash1291
Created March 25, 2018 08:40
Show Gist options
  • Save dash1291/1428a8b42066904b8239ac6307ef60dd to your computer and use it in GitHub Desktop.
Save dash1291/1428a8b42066904b8239ac6307ef60dd to your computer and use it in GitHub Desktop.
import os
import syslog
import json
images = os.popen('bash /home/ashish.dubey/service_stats.sh').read()
log_message = {}
for image in images.split('\n'):
if len(image):
service_name, tag = image.split(':')
log_message[service_name] = tag
syslog.openlog(
facility=syslog.LOG_LOCAL4,
ident='serviceStats'
)
syslog.syslog(json.dumps(log_message))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment