Last active
March 18, 2019 15:02
-
-
Save linuxmalaysia/0caefb5a45d29a607ab5d262bca1aa59 to your computer and use it in GitHub Desktop.
logstash grok uri. Find URL or URI in field data.
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
# %{URI:uri} | |
# | |
# %{URIPROTO:uriproto}://(?:%{USER:user}(?::[^@]*)?@)?(?:%{URIHOST:urihost})?(?:%{URIPATHPARAM:uripathparam})? | |
# | |
# %{EMAILLOCALPART:emaillocalpart}@%{HOSTNAME:emailhostname} | |
# | |
# %{EMAILADDRESS:emailaddress} | |
### URI / URL | |
grok { | |
match => { "message" => "%{URI:uri}" } | |
} | |
if [uri] { | |
grok { | |
match => { "uri" => "%{URIPROTO:uriproto}://(?:%{USER:user}(?::[^@]*)?@)?(?:%{URIHOST:urihost})?(?:%{URIPATHPARAM:uripathparam})?" } | |
add_tag => [ "uri_exist_email" ] | |
} | |
} | |
### Email ### | |
grok { | |
match => { "message" => "%{EMAILADDRESS:emailaddress}" } | |
} | |
if [uri] { | |
grok { | |
match => { "emailaddress" => "%{EMAILLOCALPART:emaillocalpart}@%{HOSTNAME:emailhostname}" } | |
add_tag => [ "exist_email" ] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment