I'm using this now,
input {
stdin {
}
}
filter {
grok{
match => { "message" => "\[%{TIMESTAMP_ISO8601:time}\] %{DATA:log_message}"}
}
fingerprint {
source => ['log_message']
target => "[@metadata][fingerprint]"
method => "SHA256"
}
}
output {
stdout {
codec => rubydebug {
metadata => true
}
}
}
But when i test it i'm not getting expected results. I'm trying to compare the fingerprint value generated for two same messages with different timestamps, but here the debug mode doesnt work
[2019-10-02 20:53:17.749] [logger] [info] harvester: Output queue occupancy: 0.00%.
{
"@timestamp" => 2019-10-02T21:45:00.706Z,
"host" => "host",
"@version" => "1",
"time" => "2019-10-02 20:53:17.749",
"message" => "[2019-10-02 20:53:17.749] [logger] [info] harvester: Output queue occupancy: 0.00%."
}
[2019-10-02 20:53:07.749] [logger] [info] harvester: Output queue occupancy: 0.00%.
{
"@timestamp" => 2019-10-02T21:45:16.942Z,
"host" => "host",
"@version" => "1",
"time" => "2019-10-02 20:53:07.749",
"message" => "[2019-10-02 20:53:07.749] [logger] [info] harvester: Output queue occupancy: 0.00%."
}
Where as when i set source to message
instead of log_message
, the output is in debug mode and i can see the fingerprint hash.
[2019-10-02 20:53:17.749] [logger] [info] harvester: Output queue occupancy: 0.00%.
{
"@timestamp" => 2019-10-02T21:40:12.891Z,
"@metadata" => {
"fingerprint" => "7a289d620e1128f8d19e1976744efa090921b1ad7edf42a004e5323ec40c5ce3"
},
"@version" => "1",
"host" => "host",
"time" => "2019-10-02 20:53:17.749",
"message" => "[2019-10-02 20:53:17.749] [logger] [info] harvester: Output queue occupancy: 0.00%."
}
[2019-10-02 20:53:07.749] [logger] [info] harvester: Output queue occupancy: 0.00%.
{
"@timestamp" => 2019-10-02T21:40:30.346Z,
"@metadata" => {
"fingerprint" => "440b70520e778dfda160f3258fd4ba5b6efbcd221478e850ff8dbc70b41aa5c7"
},
"@version" => "1",
"host" => "host",
"time" => "2019-10-02 20:53:07.749",
"message" => "[2019-10-02 20:53:07.749] [logger] [info] harvester: Output queue occupancy: 0.00%."
}
Any help regarding this will be helpful, also pls point to any examples that i can refer.
my logs look like the below:
[2019-10-02 21:17:00.742] [logger] [info] harvester: Output queue occupancy: 0.00%.
[2019-10-02 21:17:10.742] [logger] [info] harvester: Output queue occupancy: 0.00%.
[2019-10-02 21:17:20.742] [logger] [info] harvester: Output queue occupancy: 0.00%.
[2019-10-02 21:17:30.743] [logger] [info] harvester: Output queue occupancy: 0.00%.
[2019-10-02 21:17:40.743] [logger] [info] harvester: Output queue occupancy: 0.00%.
[2019-10-02 21:17:50.743] [logger] [info] harvester: Output queue occupancy: 0.00%.
[2019-10-02 21:18:00.743] [logger] [info] harvester: Output queue occupancy: 0.00%.
[2019-10-02 21:18:10.743] [logger] [info] harvester: Output queue occupancy: 0.00%.
My requirement is to send one log message/minute to Kibana rather than sending all 6 messages...