Skip to content

Commit

Permalink
Merge pull request #761 from StephenHynes7/logentries-handler-format
Browse files Browse the repository at this point in the history
remove hostname from metric path sent to Logentries
  • Loading branch information
kormoc committed Jan 5, 2015
2 parents 7ed8fda + 05a7e18 commit 39e3855
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/diamond/handler/logentries_diamond.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@


class LogentriesDiamondHandler(Handler):

"""
Implements the abstract Handler class
"""

def __init__(self, config=None):
"""
New instance of LogentriesDiamondHandler class
Expand Down Expand Up @@ -87,7 +89,11 @@ def _send(self):
while len(self.queue) > 0:
metric = self.queue.popleft()
topic, value, timestamp = str(metric).split()
msg = json.dumps({"event": {topic: value}})
# Remove Host Name from topic path
topic = topic.replace("." + metric.host, "")
msg = json.dumps(
{"event": {"Timestamp": timestamp, "Host": metric.host,
topic: value, }})
req = urllib2.Request("https://js.logentries.com/v1/logs/"
+ self.log_token, msg)
try:
Expand Down

0 comments on commit 39e3855

Please sign in to comment.