Zscaler operational logs use the format timestamp|level|component|message. Write a function that parses these log lines, keeps only entries whose level is exactly ERROR, and counts which requested error patterns occur in each error message.
A pattern contributes at most one count per log line, even if it appears multiple times. Matching is case-sensitive and uses literal substring matching. Malformed lines, including lines with fewer than four fields, must be ignored. The message may contain additional | characters, so split only at the first three separators.
Implement count_error_patterns(logs, patterns).
logs is a list of strings.patterns is a list of distinct, non-empty strings.ERROR log lines, including patterns with count zero.patterns in the returned dictionary.def count_error_patterns(logs, patterns):