But now, for the referrer field, I also want to extract the domain name part.
e.g. assume referrer = https://www.cnn.com/A/B/C/D
I want another field called referrer_domain_name which would be set to “https://www.cnn.com” (or just www.cnn.com without the protocol)
How would I do this when I can only set one GROK pattern in the setup page for extractors?
i.e., I’d like both the referrer and referrer_domain_name fields, but the pattern for referrer_domain_name would extract on referrerafter that was extracted from the original logs.
Hi Jan,
When I do that, I lose the ref_domain field too/
These are my grok patterns (with your help of course):
1) REFERRER : %{REF_DOMAIN}(?:%{URIPATHPARAM})?
2) REF_DOMAIN : %{URIPROTO}://(?:%{USER}(?::[^@]*)?@)?(?:%{URIHOST})?
then you might have chained it wrong together. Do not do this completely in one extractor. You want multiple or at least two. The other option would be to name the REF_DOMAIN pattern:
and you will have extracted both the domain and the uripath in two fields. If you in addition need them combined you should have two extractors. One with the initial referrer and the second with the modified one.