Cursor | Extractor

extractor.save("extractor/output/structured_logs.json")

inside Cursor Composer today: “Extract all email addresses and dates from the selected text. Output JSON.” Cursor Extractor

def extract_from_text(self, text: str, file_path: str = None): entry = "_source": file_path for field, pattern in self.schema.items(): match = re.search(pattern, text, re.IGNORECASE | re.MULTILINE) entry[field] = match.group(1) if match else None self.results.append(entry) return entry extractor

def __init__(self, schema: Dict[str, str]): self.schema = schema # field -> regex pattern self.results = [] pattern in self.schema.items(): match = re.search(pattern

That’s your first extraction. From there, build your own extractor library.

extractor = CursorExtractor(schema) for log_file in Path("data/raw/logs").glob("*.log"): content = log_file.read_text() extractor.extract_from_text(content, str(log_file))