Open jaehyunkim0211 opened 2 months ago
r"id\s=\s'(?P
import re import json import pandas as pd
log_file_path = 'logfile.txt'
pattern = re.compile(r"id\s=\s'(?P
data = [] with open(log_file_path, 'r', encoding='utf-8') as log_file: lines = log_file.readlines()
for line in lines:
match = pattern.search(line)
if match:
# 일단 id, eqp, offset은 그대로 추출
entry = match.groupdict()
# value 부분은 JSON-like 구조로 되어 있으므로 이를 파싱
value_str = entry.pop('value')
value_data = json.loads(value_str.replace("'", '"')) # JSON-like 문자열을 파싱
# 필요한 값을 추출해 entry에 추가
entry['book'] = value_data.get('book', None) # book 값 추출
data.append(entry)
df = pd.DataFrame(data)
import ace_tools as tools; tools.display_dataframe_to_user(name="Parsed Log Data", dataframe=df)
for topic in $(kafka-topics.sh --bootstrap-server
import subprocess
def get_current_git_branch(): try: branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]) return branch.strip().decode("utf-8") except subprocess.CalledProcessError: return "Unknown Branch"
print(f"Current Git Branch: {get_current_git_branch()}")
kafka-configs.sh --zookeeper
kafka-configs.sh --bootstrap-server
import subprocess
def get_current_git_branch(): try: branch = subprocess.check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]) return branch.strip().decode("utf-8") except subprocess.CalledProcessError: return "Unknown Branch"
def get_latest_commit_hash(): try: commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"]) return commit_hash.strip().decode("utf-8") except subprocess.CalledProcessError: return "Unknown Commit Hash"
def get_latest_commit_message(): try: commit_message = subprocess.check_output(["git", "log", "-1", "--pretty=%B"]) return commit_message.strip().decode("utf-8") except subprocess.CalledProcessError: return "Unknown Commit Message"
print(f"Current Git Branch: {get_current_git_branch()}") print(f"Latest Commit Hash: {get_latest_commit_hash()}") print(f"Latest Commit Message: {get_latest_commit_message()}")
https://chatgpt.com/share/a91d4231-2af9-4ad8-bd50-cee762a8198c