Skip to content

Instantly share code, notes, and snippets.

@dpetzel
Last active December 18, 2015 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dpetzel/5758291 to your computer and use it in GitHub Desktop.
Save dpetzel/5758291 to your computer and use it in GitHub Desktop.
transform_example_text_capture
# 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