def step_impl(context, metric): elastic = IndexInterface("metricbeat-*") logs = elastic.get_logs() for hit in logs: res = hit.to_dict() if res["metricset"]["name"] == metric and res["service"][ "type"] == context.module: context.result = res break
def step_impl(context, protocol): index = context.config.userdata.get("packetbeatOutput") elastic = IndexInterface(index, "15s") logs = elastic.get_logs() context.result = logs lst = list() for hit in logs: res = hit.to_dict() if res["type"] == protocol: lst.append(res) assert(len(lst) > 0)
def step_impl(context, name): index = context.config.userdata.get("filebeatOutput") logDirectory = context.config.userdata.get("filebeatLogsDirectory") filename = ntpath.basename(logDirectory) elastic = IndexInterface(index) logs = elastic.get_logs() lst = list() for hit in logs: res = hit.to_dict() if res["log"]["file"]["path"] == "/var/log/" + filename: lst.append(res) for item in lst: assert (item["agent"]["type"] == name)
def step_impl(context): index = context.config.userdata.get("filebeatOutput") logDirectory = context.config.userdata.get("filebeatLogsDirectory") filename = ntpath.basename(logDirectory) elastic = IndexInterface(index) logs = elastic.get_logs() lst = list() for hit in logs: res = hit.to_dict() if res["log"]["file"]["path"] == "/var/log/" + filename: lst.append(res) message = lst[0]["message"].splitlines() assert (message == context.result)
def step_impl(context): index = context.config.userdata.get("filebeatOutput") logDirectory = context.config.userdata.get("filebeatLogsDirectory") filename = ntpath.basename(logDirectory) elastic = IndexInterface(index) logs = elastic.get_logs() lst = list() for hit in logs: res = hit.to_dict() if res["log"]["file"]["path"] == "/var/log/" + filename: lst.append(res) del lst[len(context.results):] logLines = list() for item in lst: logLines.append(item["message"].splitlines()) for line in context.results: if line.splitlines() not in logLines: assert (False)
def step_impl(context): index = context.config.userdata.get("packetbeatOutput") elastic = IndexInterface(index, "60s") logs = elastic.get_logs() context.result = logs
def step_impl(context): elastic = IndexInterface("heartbeat-*", "3m") lst = elastic.get_logs() context.result = lst