Skip to content

Instantly share code, notes, and snippets.

View fefore's full-sized avatar

Arvind Hariharan fefore

View GitHub Profile
-='cd -'
...=../..
....=../../..
.....=../../../..
......=../../../../..
1='cd -'
2='cd -2'
3='cd -3'
4='cd -4'
5='cd -5'
@fefore
fefore / alb_filter
Created October 31, 2017 00:40
[LOGSTASH] Grok pattern for AWS ELB Application Logs
filter {
if [type] == "elb-l7" {
grok {
match => [ "message", "%{TIMESTAMP_ISO8601:timestamp} %{NOTSPACE:elb} %{IP:clientip}:%{INT:clientport:int} (?:(%{IP:backendip}:?:%{INT:backendport:int})|-) %{NUMBER:request_processing_time:float} %{NUMBER:backend_processing_time:float} %{NUMBER:response_processing_time:float} (?:-|%{INT:elb_status_code:int}) (?:-|%{INT:backend_status_code:int}) %{INT:received_bytes:int} %{INT:sent_bytes:int} \"%{ELB_REQUEST_LINE}\" \"(?:-|%{DATA:user_agent})\" (?:-|%{NOTSPACE:ssl_cipher}) (?:-|%{NOTSPACE:ssl_protocol})" ]
}
date {
match => [ "timestamp", "ISO8601" ]
}
mutate {
remove_field => [ "message", "timestamp" ]
@fefore
fefore / elb_filter
Last active March 18, 2020 08:41
[LOGSTASH] Grok pattern for AWS ELB Classic logs
filter {
if [type] == "elb-l4" {
grok {
match => [ "message", "%{TIMESTAMP_ISO8601:timestamp} %{NOTSPACE:elb} %{IP:clientip}:%{INT:clientport:int} (?:(%{IP:backendip}:?:%{INT:backendport:int})|-) %{NUMBER:request_processing_time:float} %{NUMBER:backend_processing_time:float} %{NUMBER:response_processing_time:float} (?:-|%{INT:elb_status_code:int}) (?:-|%{INT:backend_status_code:int}) %{INT:received_bytes:int} %{INT:sent_bytes:int} \"%{ELB_REQUEST_LINE}\" \"(?:-|%{DATA:user_agent})\" (?:-|%{NOTSPACE:ssl_cipher}) (?:-|%{NOTSPACE:ssl_protocol})" ]
}
date {
match => [ "timestamp", "ISO8601" ]
}
mutate {
remove_field => [ "message", "timestamp" ]
@fefore
fefore / cloudfront_filter
Last active May 23, 2018 11:09
[LOGSTASH] Grok pattern for AWS Cloudfront logs
filter {
if [cloudfront_version] {
mutate {
gsub => ["message", "\t", " "]
}
dissect {
mapping => {"message" => "%{date} %{time} %{x_edge_location} %{sc_bytes} %{clientip} %{cs_method} %{cs_host} %{cs_uri_stem} %{sc_status} %{referrer} %{agent} %{cs_uri_query} %{cookies} %{x_edge_result_type} %{x_edge_request_id} %{x_host_header} %{cs_protocol} %{cs_bytes} %{time_taken} %{x_forwarded_for} %{ssl_protocol} %{ssl_cipher} %{x_edge_response_result_type} %{cs_protocol_version}"}
convert_datatype => {
sc_bytes => "int"
sc_status => "int"
@fefore
fefore / log4net_filter
Last active October 31, 2017 00:35
[LOGSTASH] Grok Pattern for log4net logs
filter {
if [type] == "log4net" {
grok {
match => [ "message", "%{TIMESTAMP_ISO8601:timestamp} \[%{NUMBER:threadid}\] %{WORD:level}\s*%{DATA:class} \[%{DATA:NDC}\]\s+-\s+%{GREEDYDATA:message}" ]
}
mutate {
update => {
"type" => "log4net-log"
}
remove_field => [