This is my pattern log :
80.253.157.26 - - [19/Nov/2023:15:17:50 +0330] "POST /followup/danesh/5b81bc62-d82d-4f98-aacd-eab80474faca HTTP/1.1" 200 852
This is apache log . As I know if I want to use this log in logstash I can use from grok patterns:
%{COMMONAPACHELOG:request}
so it could simulate such as follow :
{
"request": [
"80.253.157.26 - - [19/Nov/2023:15:17:50 +0330] \"POST /followup/danesh/5b81bc62-d82d-4f98-aacd-eab80474faca HTTP/1.1\" 200 852",
"/followup/danesh/5b81bc62-d82d-4f98-aacd-eab80474faca"
],
"auth": "-",
"ident": "-",
"response": "200",
"bytes": "852",
"clientip": "80.253.157.26",
"verb": "POST",
"httpversion": "1.1",
"timestamp": "19/Nov/2023:15:17:50 +0330"
}
also this is my pipeline :
input{
beats {
port => 5071
}
}
filter{
grok{
match => { "message" => '%{IPORHOST:clientip} %{HTTPDUSER:ident} %{USER:auth} \[%{HTTPDATE:timestamp}\] "(?:%{WORD:verb} %{NOTSPACE:request}(?: HTTP/%{NUMBER:httpversion})?|%{DATA:rawrequest})" %{NUMBER:response} (?:%{NUMBER:bytes}|-)' }
}
}
output{
stdout{}
elasticsearch {
index => newopenbank
hosts => ["https://IP:9200"]
cacert => '/etc/logstash/certs/http_ca.crt'
user => "elastic"
password => "password"
}
}
but it does not create any index and does not work
this is logstash log :
[2023-11-20T01:21:52,356][INFO ][logstash.javapipeline ][pipeline1] Starting pipeline {:pipeline_id=>"pipeline1", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50, "pipeline.max_inflight"=>1000, "pipeline.sources"=>["/etc/logstash/conf.d/pipeline1.conf"], :thread=>"#<Thread:0x4629d2fd /usr/share/logstash/logstash-core/lib/logstash/java_pipeline.rb:134 run>"}
[2023-11-20T01:21:52,864][INFO ][logstash.javapipeline ][pipeline1] Pipeline Java execution initialization time {"seconds"=>0.51}
[2023-11-20T01:21:52,870][INFO ][logstash.javapipeline ][pipeline2] Pipeline Java execution initialization time {"seconds"=>0.51}
[2023-11-20T01:21:52,872][INFO ][logstash.inputs.beats ][pipeline1] Starting input listener {:address=>"0.0.0.0:5070"}
[2023-11-20T01:21:52,878][INFO ][logstash.javapipeline ][pipeline1] Pipeline started {"pipeline.id"=>"pipeline1"}
[2023-11-20T01:21:52,882][INFO ][logstash.inputs.beats ][pipeline2] Starting input listener {:address=>"0.0.0.0:5071"}
[2023-11-20T01:21:52,882][INFO ][logstash.javapipeline ][pipeline2] Pipeline started {"pipeline.id"=>"pipeline2"}
[2023-11-20T01:21:52,888][INFO ][logstash.agent ] Pipelines running {:count=>2, :running_pipelines=>[:pipeline2, :pipeline1], :non_running_pipelines=>[]}
[2023-11-20T01:21:52,925][INFO ][org.logstash.beats.Server][pipeline1][355b5961c5bd22351a4cf5494bc9b254124e7179d0d5df19c80c7a9c27b9bd90] Starting server on port: 5070
[2023-11-20T01:21:52,926][INFO ][org.logstash.beats.Server][pipeline2][65fe548fb9a6519537f8f4576c444eb7c28ae6d684a8ec03cb8f57a91b84aa5d] Starting server on port: 5071