Why not start with the standard Apache Combined pattern instead of building everything from scratch? Your current log entry looks like a standard Apache Combined line with an extra IP address in the beginning and a couple of extra fields at the end.
No, but you can use COMBINEDAPACHELOG as a starting point for your expression. Start by changing the pattern to %{IP:whatever} %{COMBINEDAPACHELOG} to pick up the extra IP address. Does that work so far? Then continue with the extra fields at the end of the line.
How do we use key/value pairs in the match format ?
For instance: %{IP:xyz}, in this is IP a predefined value which needs to be used? Similarly what value will be "xyz" in this example?
Let's say in apache log format, I use a custom log format %T which prints the time taken to serve the request. Now I want to parse this in logstash, how will I do it is the question?
Similarly what value will be "xyz" in this example?
That's the name of the field where the string matched by the pattern will be placed.
Let's say in apache log format, I use a custom log format %T which prints the time taken to serve the request. Now I want to parse this in logstash, how will I do it is the question?
%T expands to a floating point number, right? Then NUMBER would be a suitable pattern:
%{NUMBER:duration}
Additionally, to make sure the field is stored as a floating point number (rather than a string):
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.