To extract the contents of the tar.gz file to the current directory, type.tar.gz file is located, (replacing file_ with the actual name of your file) From the terminal, change directory to where your.So the search is happening for flashgrid_cluster and node_monitor_error.log file content, for which two nested tar.gz should be analyzed. py file and pass path of the tar.gz file #. S3_loader.load_tar_file_s3_into_object_without_download(s3_filepath=str(sys.argv))Ģ. Print(clustername.strip(),cur_node_name,cur_node_mon_file_line_splitted, time, cur_node_mon_file_line_splitted + " " + cur_node_mon_file_line_splitted.strip()) # Extracting necessary values after spliting the content by delimiter " " Time = cur_node_mon_file_content_line.split(" ") + " " + cur_node_mon_file_content_line.split(" ")Ĭur_node_mon_file_line_splitted = cur_node_mon_file_content_line.split(" ") # Extracting time from the string, knowing the exact position If match in cur_node_mon_file_content_line and not (notmatch in cur_node_mon_file_content_line): # Selecting lines from the extracted file and filtering based on match criteria (match, notmatch variables)įor cur_node_mon_file_content_line in cur_node_mon_file_content: # if "Cluster Name:" in fgclusternameline: # for fgclusternameline in fgclusternamecontent: # fgclusternamecontent = node1gz.extractfile(fgclustername) # Extracting content of node_monitor_error.log fileĬur_node_mon_file_content = cur_gz_file_extracted.extractfile(cur_node_mon_file) # print(nodemonfilelist,nodemonfilelist,nodemonfilelist) # Path to node_monitor_error.log contains hostname inside so extracting string that is the hostnameĬur_node_name = cur_node_mon_file.split("/") # print(tarfile.open(fileobj=tar.extractfile(i)).getmembers())Ĭur_node_mon_file = # nodegzlist.append(tarfile.open(fileobj=tar.extractfile(i)))Ĭur_gz_file_extracted = tarfile.open(fileobj=tar.extractfile(i)) # Extracting file node_monitor_error.log from all nested tar.gz files # Extracting text that contains string "Cluster Name:"įor fgclusternameline in fgclusternamecontent: Node1gz = tarfile.open(fileobj=tar.extractfile(childgz))įgclustername = įgclusternamecontent = node1gz.extractfile(fgclustername) # Extracting file named flashgrid_cluster which is located in the first tar.gz S3_object = self.s3_client.get_object(Bucket=self.AWS_STORAGE_BUCKET_NAME, Key=s3_filepath)Ĭhildgz = Note: Update the following entries in the file according to your environment.ĪWS_SECRET_ACCESS_KEY = "my secret key goes here"ĪWS_STORAGE_BUCKET_NAME = "my bucket name goes here"Ĭontent of extracts3tar.py: #!/usr/bin/python2.7Īws_access_key_id=self.AWS_ACCESS_KEY_ID,Īws_secret_access_key=self.AWS_SECRET_ACCESS_KEY)ĭef load_tar_file_s3_into_object_without_download(self, s3_filepath):
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |