def save(self):
        #get one .tar.gz file

        proxy001_tarfiles = LogFilesTarGzGlob.test_glob3()
        tar_num = len(proxy001_tarfiles)

        for i in range(tar_num):
            #get 1 gzfile.
            gzfile = proxy001_tarfiles[i]

            #gzfile open.
            gzfileinfo = GzFileInfo(gzfile)
            gzfile = ExtractFiles(gzfileinfo.gzfilename)

            print "gzfileinfo: " + gzfileinfo.gzfilename

            #log file extract one by one
            for extractedfileobj in gzfile.extract_files():

                cur_file = gzfile.cur_extract_file

                print cur_file
                #db collection resetting.
                table = self.conn.set_cur_col(cur_file)

                log_data = LogDataLineSplit(extractedfileobj)

                for data in log_data.read_line():
                    #build structure
                    item = LogDataStructure(data).log_data
                    item.__setitem__("log_server", gzfileinfo.log_server)
                    item.__setitem__("log_date", gzfileinfo.log_date)
                    table.insert(item)
Example #2
0
    def save(self):
        #get one .tar.gz file

        proxy001_tarfiles = LogFilesTarGzGlob.test_glob3()
        tar_num = len(proxy001_tarfiles)

        for i in range(tar_num):
            #get 1 gzfile.
            gzfile = proxy001_tarfiles[i]

            #gzfile open.
            gzfileinfo = GzFileInfo(gzfile)
            gzfile = ExtractFiles(gzfileinfo.gzfilename)

            print "gzfileinfo: " + gzfileinfo.gzfilename

            #log file extract one by one
            for extractedfileobj in gzfile.extract_files():

                cur_file = gzfile.cur_extract_file

                print cur_file
                #db collection resetting.
                table = self.conn.set_cur_col(cur_file)

                log_data = LogDataLineSplit(extractedfileobj)

                for data in log_data.read_line():
                    #build structure
                    item = LogDataStructure(data).log_data
                    item.__setitem__("log_server", gzfileinfo.log_server)
                    item.__setitem__("log_date", gzfileinfo.log_date)
                    table.insert(item)
def test():
    #get one .tar.gz file
    files = LogFilesTarGzGlob.test_glob()
    gzfile = files[0]

    gzfileinfo = GzFileInfo(gzfile)
    gzfile = ExtractFiles(gzfileinfo.gzfilename)
    extractedfileobj = None

    for i in gzfile.extract_files():
        extractedfileobj = i
        print extractedfileobj.name
        print gzfile.cur_extract_file
        #print gzfile.cur_extract_file.split('.')[1].split('/')[1]

    print "gzfileinfo: " + gzfileinfo.log_server + gzfileinfo.log_date

    return extractedfileobj
def test():
    #get one .tar.gz file
    files = LogFilesTarGzGlob.test_glob()
    gzfile = files[0]


    gzfileinfo = GzFileInfo(gzfile)
    gzfile = ExtractFiles(gzfileinfo.gzfilename)
    extractedfileobj = None

    for i in gzfile.extract_files():
        extractedfileobj = i
        print extractedfileobj.name
        print gzfile.cur_extract_file
        #print gzfile.cur_extract_file.split('.')[1].split('/')[1]


    print "gzfileinfo: " + gzfileinfo.log_server + gzfileinfo.log_date

    return extractedfileobj