Hello, I use filebeat to send logs to logstash and then I use Logstash to parse them. For exemple this line :
31/5/2018 01:06:24.073 (TACHE) 30/5/2018/D T UE_TECXXX_J_TN_SSH002_DELCLONE_LPSACAS1(14033)/UE_TECXXX_X_LL_OPE003_TECHNIQUE TER STATUS : TN Terminaison normale de la tâche (TN EXIT CODE 0)
Become after groke parse :
{
"DATE_TACHE" => "30/5/2018"
"HEURE_TACHE" => "01:06:24.073"
"NOM_TACHE" => "UE_TECXXX_J_TN_SSH002_DELCLONE_LPSACAS1"
"LOCALISATION_TACHE" => "UE_TECXXX_X_LL_OPE003_TECHNIQUE"
"CODE ERREUR TACHE" => "0"
}
And sometime, the same task (tache in french) is done several times, but not at the same moment. That's why I would like to know if I had possibility to keep the first event of the couple NOM_TACHE/LOCALISATION_TACHE and drop every other same identic couple at this one
For exemple, after the first exemple above, this task should be dropped :
{
"DATE_TACHE" => "30/5/2018"
"HEURE_TACHE" => "07:16:24.143"
"NOM_TACHE" => "UE_TECXXX_J_TN_SSH002_DELCLONE_LPSACAS1"
"LOCALISATION_TACHE" => "UE_TECXXX_X_LL_OPE003_TECHNIQUE"
"CODE ERREUR TACHE" => "252"
}
I'm completly stuck on this problem...
Can somebody help me ?
Thx for all.
Here my pipeline :
### INPUT SECTION ###
input
{
beats
{
port => 5044
}
}
### FILTER SECTION ###
filter
{
grok
{
match => { "message" => [ "%{DATE_EU:DATE_LOG} %{TIME:HEURE_TACHE} \(%{WORD:TYPE_TACHE}\) %{DATE_EU:DATE_TACHE}/D . %{WORD:NOM_TACHE}\(%{NUMBER:ID_TACHE}\)/%{WORD:LOCALISATION} (?<STATUS>[A-Z]\w++\s+[A-Z]\w+) : %{WORD:CODE_TACHE} %{GREEDYDATA:DESCRIPTION}" ] }
}
if ([message] =~ "CODE")
{
grok
{
match => { "DESCRIPTION" => [ "%{NUMBER:CODE_ERREUR_TACHE}" ] }
}
}
mutate
{
remove_field => [ "@version","CODE_TACHE","DATE_LOG","ID_TACHE","STATUS","TYPE_TACHE","_id","_index","_score","_type","beat.hostname","beat.name","beat.version","filetype","host","offset","prospector.type","tags" ]
convert => { "CODE_ERREUR_TACHE" => "integer" }
}
if [message] !~ "réalisées" and [message] !~ "CODE"
{
drop { }
}
if [message] =~ "groupe"
{
drop { }
}
date
{
match => [ "DATE_TACHE", "dd/MM/yyyy" ]
}
}
### OUTPUT SECTION ###
output
{
elasticsearch
{
hosts => "http://localhost:9200"
index => "vegaaprodd"
}
stdout { codec => rubydebug }
}