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

Task:4151976 Log analyzer - adding support for parsing telemetry logs #273

Merged
merged 2 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Copyright © 2013-2024 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED.
#
# This software product is a proprietary product of Nvidia Corporation and its affiliates
# (the "Company") and all right, title, and interest in and to the software
# product, including all associated intellectual property rights, are and
# shall remain exclusively with the Company.
#
# This software product is governed by the End User License Agreement
# provided with the software product.
#

import re
from typing import Match

from loganalyze.log_parsing.base_regex import RegexAndHandlers

ITERATION_TIME_REGEX = re.compile(r"^\[ExportAPI_STATS\] Iteration time"
r"\: ([\d\.]+) sec \@ \[([\d\-]+ [\d\:\.]+)\]$")

TIMEOUT_DUMP_CORE_REGEX = re.compile(r"^timeout: the monitored command dumped core$")

TOTAL_SWITCH_PORTS_REGEX = re.compile(r"^.*Total switches\/ports \[(\d+)\/(\d+)\]\,.*$")

COLLECTX_VERSION_REGEX = re.compile(r"^\[ExportAPI\] Collectx version ([\d\.]+)$")

def iteration_time(match: Match):
iteration_time_sec = match.group(1)
timestamp = match.group(2)
return ("iteration_time", timestamp, iteration_time_sec, None)

def timeout_dump_core(_: Match):
return ("timeout_dump_core", None, None, None)

def total_switch_ports(match: Match):
total_switches = match.group(1)
total_ports = match.group(2)
return ("total_switch_ports", None, total_switches, total_ports)

def collectx_version(match:Match):
collectx_version_str = match.group(1)
return ("collectx_version", None, collectx_version_str, None)

ibdiagnet2_headers = ("type", "timestamp", "data", "extra")

ibdiagnet2_primary_log_regex_cls = \
RegexAndHandlers("ufm_logs_ibdiagnet2_port_counters.log", ibdiagnet2_headers)
ibdiagnet2_secondary_log_regex_cls = \
RegexAndHandlers("secondary_telemetry_ibdiagnet2_port_counters.log", ibdiagnet2_headers)

regex_funcs_map = {ITERATION_TIME_REGEX: iteration_time,
TIMEOUT_DUMP_CORE_REGEX:timeout_dump_core,
TOTAL_SWITCH_PORTS_REGEX: total_switch_ports,
COLLECTX_VERSION_REGEX: collectx_version}

for regex, regex_func in regex_funcs_map.items():
ibdiagnet2_primary_log_regex_cls.add_regex(regex, regex_func)
ibdiagnet2_secondary_log_regex_cls.add_regex(regex, regex_func)
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@
from loganalyze.log_parsing.ibdiagnet_log_regex import ibdiagnet_log_regex_cls
from loganalyze.log_parsing.console_log_regex import console_log_regex_cls
from loganalyze.log_parsing.rest_api_log_regex import rest_api_log_regex_cls
from loganalyze.log_parsing.ibdiagnet2_port_counters_log_regex import \
ibdiagnet2_primary_log_regex_cls, ibdiagnet2_secondary_log_regex_cls

logs = [
event_log_regex_cls,
ufm_health_regex_cls,
ufm_log_regex_cls,
ibdiagnet_log_regex_cls,
console_log_regex_cls,
rest_api_log_regex_cls
rest_api_log_regex_cls,
ibdiagnet2_secondary_log_regex_cls,
ibdiagnet2_primary_log_regex_cls
]

logs_regex_csv_headers_list = []
Expand Down