Last active
September 26, 2017 12:44
-
-
Save beneshed/dae911d817aa6805f6a11195c9345c05 to your computer and use it in GitHub Desktop.
Python Named Regex for ALB
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
regex = r"(?P<PROTOCOL>http|https|h2) (?P<TIMESTAMP>[^ ]*) (?P<PATH>[^ ]*) (?P<SOURCE_IP>[^ ]*):(?P<SOURCE_PORT>[0-9]*) ((?P<DESTINATION_IP>[^ ]*):(?P<DESTINATION_PORT>[0-9]*)|-) (?P<REQUEST_PROCESS_TIME>[-.0-9]*) (?P<TARGET_PROCESSING_TIME>[-.0-9]*) (?P<RESPONSE_PROCESSING_TIME>[-.0-9]*) (?P<ELB_STATUS_CODE>-|[0-9]*) (?P<TARGET_STATUS_CODE>-|[0-9]*) (?P<RECEIVED_BYTES>[-0-9]*) (?P<SENT_BYTES>[-0-9]*) \"(?P<REQUEST_TYPE>[^ ]*) (?P<URL>[^ ]*) (?P<HTTP_VERSION>- |[^ ]*) (?P<USER_AGENT>\".*\") (?P<SSL_CIPHER>[-A-Za-z0-9]+) (?P<SSL_VERSION>[-A-Za-z0-9.]+) (?P<RESOURCE>[\/A-Za-z0-9:-]+) \"(?P<END_PATH>[A-Za-z0-9-=;]+)\"" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not the most effective, but groups well