I am relatively new to ELK and have gotten pretty far setting up my custom grok pattern for apache logs. I have them slightly customized. I have it 90% of the way there but I'm seeing a failure when the log line has "domain.com" vs "https://domain.com". When the log has the former it fails, but it works fine for the latter. I've had issues in the past where www.domain.com and domain.com were being treated as unequal and I am trying to avoid that in my latest build.
Log lines. First one fails, second one matches.
12.34.56.78 - - [09/Oct/2017:22:23:00 +0000] domain.com "POST /yt.php HTTP/1.1" 301 240 "domain.com" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.75 Safari/537.36" Server=aws8 "-" 103224 0
12.34.56.78 - - [09/Oct/2017:22:24:45 +0000] domain2.com "GET /images/icons/32-twitter.png HTTP/1.1" 200 462 "http://domain2.com/programs/coaching.html" "Mozilla/5.0 (iPhone; CPU iPhone OS 11_0_2 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A421 Safari/604.1" Server=aws8 "-" 744 0
It's failing just after HEAD. 'http://98.76.54.3:80/mysql/mysqlmanager/' does not match (?:%{URIPATHPARAM:request}|*), which I do not even think is a valid grok pattern. You really need to make sure what is displayed in the post matches the actual pattern (note the backslash on the square brackets in my version). Use the </> (preformatted text) button.
You have been very helpful, thank you. I'm down to less than 2% of my log lines in the last 24 hours having a parse failure, so its getting better! The next one I need to tackle is below. It always shows with a 408 request timeout which does not complete the log line and throws an error. I'd like to keep the data so that I can have reports on all error types. How can I get my grok to fill in as much data that is included even if it leaves off the trailing options?
Either use a completely different grok expression (a grok filter can list multiple expressions that will be tried in order) or you could make everything after "408 -" optional with (...)?.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.