Hello
I'm sending an asterisk log from filebeat to logstash,
The format of the logs is as follows.
[May 19 14:57:19] NOTICE [8583] chan_sip.c: Registration from '<sip: 34541@xx.xx.xx.xx>' failed for '91.214.44.144: 2718 '- Wrong password
Download a filter from github to be able to separate the asterisk logs.
Now my question is if in the field of log_message you can take the ip that is failing in the password and separate it to generate a new field in elastic with that ip
the ip that I wish to keep would be this 91.214.44.144, I do not know if there is a way to generate a field with this info
I attach my logstash filter
filter {
if [source] == "security" {
if [message] =~ /^[/ {
grok {
match => {
"message" => "[%{SYSLOGTIMESTAMP:log_timestamp}] +(?<log_level>(?i)(?:debug|notice|warning|error|verbose|dtmf|fax|security)(?-i))[%{INT:thread_id}](?:[%{DATA:call_thread_id}])? %{DATA:module_name}:(?: +[=|-]{2})? %{GREEDYDATA:log_message}"
}
add_field => [ "received_timestamp", "%{@timestamp}" ]
add_field => [ "process_name", "asterisk" ]
}
date { match => [ "log_timestamp", "MMM d HH:mm:ss", "MMM dd HH:mm:ss" ] }
if ![log_message] {
mutate {
add_field => {"log_message" => ""}
}
} # End default asterisk log fields
} # end log lines that begin with '['
} # end filter for type == asterisk_debug
} # end filter
I am a novice in the use of grok