Untitled

mail@pastecode.io avatar
unknown
plain_text
6 months ago
955 B
1
Indexable
Never
Code--


def get_bookmark_index(vm_ip):
    with open(bookmark_properties_file, encoding='latin-1') as file:
        for line in file:
            if line.startswith(str(vm_ip) + "_bookmark_log"):
                return int(line.split("=")[1].strip())
    return 0



def get_timestamp_from_line(line):
    # Extract the timestamp from the line
    timestamp = line.split()[0]
    return timestamp

def purge_logs():
    vms = get_VMList()

    for vm in vms:
        syslog_file = get_syslog_file_location(vm)
        retention_period = get_retention_period(vm)
        bookmark_index = get_bookmark_index(vm_ip)

        
        
Error-

Traceback (most recent call last):
  File "/App/jar/KPI/syslog_purging_python.py", line 137, in <module>
    purge_logs()
  File "/App/jar/KPI/syslog_purging_python.py", line 91, in purge_logs
    bookmark_index = get_bookmark_index(vm_ip)
NameError: name 'vm_ip' is not defined