#!/bin/bash
log="2019/10/04 03:03:12.938 [error]: some exception happened
2019/10/04 03:03:12.938 [error]: some exception happened
2019/10/04 03:53:35.595 [info]: there is a benign error in the code"

grep '\[error]:' <<< "$log"

awk '$3 == "[error]:"' <<< "$log"