cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1586
Views
0
Helpful
1
Replies

How can i parse the AnyConnect.txt logfile (is a part of the Dart File)

Hi all, i have problems with reading the AnyConnect.txt log file, i need a parser for my log file viewer (GamutLogViewer).

The Windows Eventlog Viewer (AnyConnect.evtx) is not a good tool for me to read this file, this is the reason for me to read the *.txt file with my LogFileViewer, but i have no parser for it. Any other logfile that i analyse have seperated columns for date, time, process, message, .... so it makes it easier for me to read them in my viewer.

Example

Date        : 06/22/2017
Time        : 08:24:24
Type        : Information
Source      : acvpnui

Description : Function: ConnectMgr::processCSDData
File: ConnectMgr.cpp
Line: 3533
CSD detected, launching CSD.


******************************************

Date        : 06/22/2017
Time        : 08:24:24
Type        : Information
Source      : acvpnui

Description : Message type information sent to the user:
Posture Assessment: Required for access


******************************************

Date        : 06/22/2017
Time        : 08:24:24
Type        : Information
Source      : acvpnui

Description : Function: ConnectMgr::launchCSDStub
File: ConnectMgr.cpp
Line: 7567
Gathering CSD version information.


******************************************

1 Reply 1

増田亮
Level 1
Level 1

You can convert the txt file to the Microsoft Excel file by Python.

sample code is here:

 

f = r'<your path>\Cisco AnyConnect Secure Mobility Client\AnyConnect.txt'

import re,datetime, os
import pandas as pd

pd.DataFrame([[
    {
        'Datetime': datetime.datetime.strptime(Date+' '+Time,'%m/%d/%Y %H:%M:%S'),
        'Type': Type,
        'Source': Source,
        'Description': Description
    }
    for Date,Time,Type,Source,Description in
        re.findall(r'Date +: (.+)\n+Time +: (.+)\n+Type +: (.+)\n+Source +: (.+)\n+Description +: ((?:.|\s)+)',d)][0]
            for d in open(f).read().split('\n******************************************\n')[:-1]]).to_excel(
                os.path.join(os.path.dirname(f),'AnyConnect.xlsx'),index=False)