Last active
December 2, 2016 09:20
-
-
Save pcolazurdo/4538923 to your computer and use it in GitHub Desktop.
LogStash configuration Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
java -cp . logstash.runner agent -f logstash.conf -- web --backend elasticsearch:///?local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Add this line to patterns/grok-patterns | |
TELEFENGINX %{IPORHOST:site} %{IPORHOST:clientip} - - \[%{HTTPDATE:timestamp}\] "(?:%{WORD:verb} %{URIPATHPARAM:request}(?: HTTP/%{NUMBE:httpversion})?|-)" %{NUMBER:response} (?:%{NUMBER:bytes}|-) %{QS:referrer} %{QS:agent} %{QS:forwardedfor} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
file { | |
type => nginx_web | |
path => ["/var/log/nginx/*"] | |
exclude => ["*.gz"] | |
} | |
} | |
filter { | |
grok { | |
type => "nginx_web" | |
patterns_dir => [ "/tmp/logstash/patterns" ] | |
pattern => "%{TELEFENGINX}" | |
} | |
} | |
output { | |
elasticsearch { embedded => true } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// The following is the sample nginx.conf that defines the log used by the grok pattern defined above | |
log_format combined_with_server '$http_host $remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent" "$http_x_forwarded_for"'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This does not seem to work anymore. This is the error I get when running with this configuration:
[2016-12-02T10:16:56,423][ERROR][logstash.agent ] fetched an invalid config {:config=>"input {\n file {\n type => nginx_web\n path => [\"/Users/justusblumer/Downloads/access_logs_curved/access-curved.log.*\"]\n exclude => [\"*.gz\"]\n }\n}\n\nfilter {\n grok {\n type => \"nginx_web\"\n patterns_dir => [ \"/tmp/logstash/patterns\" ]\n pattern => \"%{TELEFENGINX}\"\n }\n}\n\noutput {\n elasticsearch { embedded => true }\n}\n", :reason=>"The setting
typein plugin
grokis obsolete and is no longer available. You can achieve this same behavior with the new conditionals, like:
if [type] == "sometype" { grok { ... } }. If you have any questions about this, you are invited to visit https://discuss.elastic.co/c/logstash and ask."}