I'm trying to use Logstash to send Atlassian access logs to opensearch.
I'm absolutely new to the topic but can successfully send other logs and view them.
It's the jira access logs that I cannot make work.
Having tried a lot in vain, I'm hoping to get an answer in the community. Please help...
My conf file for the jira access log is below:
input {
file {
path => "/path/to/jira/application/logs/access_log.%{+YYYY-MM-dd}"
codec => multiline {
pattern => "^\s"
what => "previous"
}
}
}
filter {
grok {
match => { "message" => "^%{IP:ip}\s+%{WORD:userid}\s+%{USER:user}\s+\[%{HTTPDATE:timestamp}\]\s+%{GREEDYDATA:message}" }
}
date {
match => [ "timestamp" , "dd/MMM/yyyy:HH:mm:ss Z" ]
}
}
output {
opensearch {
hosts => ["https://nn.nnn.nn.nn:9200"]
ssl_certificate_verification => false
index => "jira-access-log-%{+YYYY.MM.dd}"
user => "logstash"
password => "somepassword"
}
}
The example log lines are below:
NNN.NNN.NNN.NN 123x456x789 - [26/Aug/2023:12:53:21 +0200] "GET /rest/capabilities/navigation?lang=de-DE HTTP/1.0" 200 1117 8 "-" "Confluence-7.19.12 (18035)" "-"
NNN.NNN.NNN.NN 901x2345x67890 some.string.text [26/Aug/2023:12:55:13 +0200] "PUT /rest/api/latest/issue/DUMMYIS-1234- HTTP/1.0" 400 123 13 "-" "Atlassian HttpClient 0.23.0 / Atlassian JIRA Rest Java Client-4.0.3-sc (0) / Default" "username"
I tried the filter plugin to use grok (and it itself seems to work because I have tried it for at least one log line example shown above. I added the date but I'm not sure if it's right/needed...
I also tried to use dissect but I am not sure if it worked...
filter {
dissect {
mapping => { "message" => "%{ip} %{id} %{user} [%{[@metadata][timestamp]} %{timezone}] %{message}" }
}
date {
match => [ "[@metadata][timestamp]", "dd-MMM-yyyy:HH:mm:ss" ] #is this correct?
target => "@timestamp"
}
}
Logstash starts without errors and the pipeline is successfully created.
However I'm not sure if I did it right because I cannot create an index pattern in opensearch..
I get: "The index pattern you've entered doesn't match any indices."
So I'm not sure if the index is even getting created / data being sent. And whether I need to do anything else in opensearch itself...?
I'd really appreciate it if someone could please help me figure this out? Thanks so much,
Dan