- have ping logs files
- used the excerpt of it as a sample for grok filter and tested with grok
_debugger and all good - When I pass the full file will all logs instead of excerpt get _grokparsefailure though was working when I simply used an excerpt of files.
filebeat.yml
filebeat.inputs:
- type: log
enabled: true
paths:
- "/usr/share/filebeat/mylog/portal/*"
fields:
project_type: arcgis
- type: log
enabled: true
paths:
- "/usr/share/filebeat/mylog/website/*"
fields:
project_type: web
#filebeat.config.modules:
# path: /usr/share/filebeat/modules.d/*.yml
output.logstash:
hosts: ["logstash:5044"]
processors:
- add_docker_metadata:
host: "unix:///host_docker/docker.sock"
Logstash.conf
input {
beats {
port => 5044
ssl => false
}
}
filter {
if "arcgis" in [fields][project_type]{
grok {
match => {"message" => "%{DATE_US:date} %{TImE:time} %{WORD:am_pm} \- Reply from %{IP:ip}\: bytes=32 time=%{NUMBER:timetaken:int}\ms TTL=%{NUMBER:ttl:int}"}
}
}
if "web" in [fields][project_type]{
grok {
match => {"message" => "%{DATE_US:date} %{TIME:time} %{WORD:am_pm} \- Reply from %{IP:ip}\: bytes=32 time=%{BASE10NUM:timetaken:float}\ms TTL=%{NUMBER:ttl:int}"}
}
}
}
output {
if "arcgis" in [fields][project_type]{
elasticsearch {
hosts => ["elasticsearch:9200"]
index => "portal-test"
}
stdout {
codec => rubydebug
}
}
else if "web" in [fields][project_type]{
elasticsearch {
hosts => ["elasticsearch:9200"]
index => "website-test"
}
stdout {
codec => rubydebug
}
}
else {
elasticsearch {
hosts => ["elasticsearch:9200"]
index => "none-found"
}
stdout {
codec => rubydebug
}
}
}
Problem:
created a file input for file beats taking excerpts from files making sure it's similar to whole files. Done this just to decrease logs size. Worked well but not when passing the whole file had an issue. Not able to figure out the exact cause.
Samples:
8/5/2021 7:31:12 AM -
8/4/2021 9:08:01 AM - Pinging 10.18.6.70 with 32 bytes of data:
8/4/2021 9:08:01 AM - Reply from 10.18.6.70: bytes=32 time<1ms TTL=127
8/4/2021 8:19:12 PM - Reply from 10.18.6.70: bytes=32 time=1ms TTL=127
8/4/2021 8:19:12 PM -
8/4/2021 10:52:58 AM - Request timed out.
8/4/2021 8:19:12 PM - Ping statistics for 10.18.6.70:
8/4/2021 8:19:12 PM - Packets: Sent = 3000, Received = 1000, Lost = 32 (0% loss),
8/4/2021 8:19:12 PM - Approximate round trip times in milli-seconds:
8/4/2021 8:19:12 PM - Minimum = 0ms, Maximum = 72ms, Average = 0ms