Last active
December 18, 2015 08:59
-
-
Save dpetzel/5758291 to your computer and use it in GitHub Desktop.
transform_example_text_capture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Assume your Event was "MyCoolApp Tossed An Error" | |
import re | |
if getattr(evt, "datasourceId", None) is not None: | |
# Start with any characters up to the first space. Save the capture as variable named app_name | |
re_string = "^(?P<app_name>.*?)\s.*?" | |
m = re.search(re_string, evt.datasourceId) | |
if m and m.group('app_name'): | |
app_name = m.group('app_name') | |
# Now set the component equal to the app name | |
evt.component = app_name |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment