@stephenb
Here you are the sample doc
{
"took" : 3,
"timed_out" : false,
"_shards" : {
"total" : 1,
"successful" : 1,
"skipped" : 0,
"failed" : 0
},
"hits" : {
"total" : {
"value" : 1,
"relation" : "eq"
},
"max_score" : 1.0,
"hits" : [
{
"_index" : "appm-2021.11.02",
"_type" : "_doc",
"_id" : "gP_I4XwB2j3mkX2mqYWL",
"_version" : 2,
"_score" : 1.0,
"_source" : {
"day" : "02",
"logtime" : "2021-11-02 18:52:57.537",
"year" : "2021",
"agent" : {
"id" : "556a375b-0ecf-4c10-962b-58f3b5aa8bee",
"ephemeral_id" : "392c04a8-7243-4b1f-a571-154321130e62",
"version" : "7.10.0",
"hostname" : "appsrv1.corp",
"type" : "filebeat",
"name" : "appsrv1.corp"
},
"tags" : [
"app",
"beats_input_codec_plain_applied"
],
"app_msg" : "Skipping checkpoint (no pages were modified) [checkpointBeforeLockTime=4ms, checkpointLockWait=0ms, checkpointListenersExecuteTime=4ms, checkpointLockHoldTime=5ms, reason='timeout']",
"logLevel" : "INFO",
"event" : {
"timezone" : "CET"
},
"@timestamp" : "2021-11-02T17:52:57.537Z",
"month" : "11",
"message" : "2021.11.02 18:52:57.537 [db-checkpoint-thread-#59] INFO o.a.i.i.p.c.p.GridCacheDatabaseSharedManager - Skipping checkpoint (no pages were modified) [checkpointBeforeLockTime=4ms, checkpointLockWait=0ms, checkpointListenersExecuteTime=4ms, checkpointLockHoldTime=5ms, reason='timeout']",
"@version" : "1",
"time" : "18:52:57.537",
"input" : {
"type" : "log"
},
"log" : {
"offset" : 500197,
"file" : {
"path" : "/apps/m/log/application.log"
}
},
"ecs" : {
"version" : "1.6.0"
},
"application" : "db-checkpoint-thread-#59",
"host" : {
"id" : "73c99579400044adb0a3fe01931c97b0",
"os" : {
"kernel" : "3.10.0-1160.6.1.el7.x86_64",
"platform" : "rhel",
"family" : "redhat",
"version" : "7.9 (Maipo)",
"codename" : "Maipo",
"name" : "Red Hat Enterprise Linux Server"
},
"architecture" : "x86_64",
"containerized" : false,
"ip" : [
"192.168.1.1"
],
"mac" : [
"00:10:36:93:b1:ef"
],
"hostname" : "appsrv1.corp",
"name" : "appsrv1.corp"
},
"class" : "o.a.i.i.p.c.p.GridCacheDatabaseSharedManager"
}
}
]
}
}
and original message from log file:
2021.11.02 18:52:57.537 [db-checkpoint-thread-#59] INFO o.a.i.i.p.c.p.GridCacheDatabaseSharedManager - Skipping checkpoint (no pages were modified) [checkpointBeforeLockTime=4ms, checkpointLockWait=0ms, checkpointListenersExecuteTime=4ms, checkpointLockHoldTime=5ms, reason='timeout']
Some times the document _version is higher than 2, sometimes this is 3 or 4.
As you can see from the sample the document was create by filebeat. Filebeat sends documents to logstash and logstash to Elasticsearch. In Logstash configuration there is such roles for tag "app":
if "app" in [tags] {
grok {
match => ["message", "%{YEAR:year}.%{MONTHNUM:month}.%{MONTHDAY:day} %{TIME:time} \[%{DATA:application}] %{LOGLEVEL:logLevel} %{SPACE}*%{JAVACLASS:class} %{NOTSPACE} %{GREEDYDATA:app_msg}"]
}
}
and for hostname:
else if "appsrv1" in [host][hostname] and "apps" in [log][file][path] {
mutate {
replace => { "[@metadata][index_prefix]" => "appm-%{+YYYY.MM.dd}" }
}
}
and output from logstash:
output {
elasticsearch {
hosts => ["https://${HOSTNAME}:9200"]
cacert => '/etc/logstash/certs/ca.crt'
user => 'logstash_internal'
password => '${ES_PWD}'
ilm_enabled => false
document_id => "%{[@metadata][_id]}"
index => "%{[@metadata][index_prefix]}"
}
}
Best Regards,
Dan