I have json files coming in the following format:
[
{
"user": "Beta",
"percent": 28,
"startTime": "2022-07-07T11:31:45",
"type": "CPU",
"total": 1072987793,
"Location": "locationB",
"desk": "MAC"
},
{
"user": "Alpha",
"percent": 86,
"startTime": "2022-07-07T11:31:45",
"type": "CPU",
"total": 1072987733,
"Location": "locationA",
"desk": "LIN"
},
{
"user": "Charlie",
"percent": 03,
"startTime": "2022-07-07T11:31:45",
"type": "CPU",
"total": 1072987724,
"Location": "locationA",
"desk": "LIN"
},
{
"user": "test",
"percent": 15,
"startTime": "2022-07-07T11:31:45",
"type": "CPU",
"total": 1072987778,
"Location": "locationB",
"desk": "MAC"
},
{
"user": "Delta",
"percent": 28,
"startTime": "2022-07-07T11:31:45",
"type": "CPU",
"total": 1072987793,
"Location": "location1",
"desk": "MAC"
},
{
"user": "Juliana",
"percent": 28,
"startTime": "2022-07-07T11:31:45",
"type": "CPU",
"total": 1072987793,
"Location": "location1",
"desk": "MAC"
}
]
This is my input:
input {
http {
port => 8287
ssl => true
ssl_certificate_authorities => ["xxxxxxxxxxxxxxxx.crt"]
ssl_certificate => "path.crt"
ssl_key => "xxxxxxxxxxxxxxxxxx"
ssl_verify_mode => peer
}
}
filter {
grok {
match => { "desktop" => "(?<site>^.{2}%{DATA}-%{DATA}%{INT:pod}%{GREEDYDATA}" }
}
json {source => "message"}
mutate {
add_field => { 'processed_at' => "%{@timestamp}" }
remove_field => ["headers"]
}
date {
match => ['startTime', "yyyy-MM-dd'T'HH:mm:ss", "ISO8601"]
remove_field => ['startTime']
}
}
output {
elasticsearch {
hosts=>["https:xxxxxx:9200, "https:xxxxxx:9200]
index => "testCM"
user => XXXX
password => "xxxxxxxxx"
keystore => "xxxx.jks"
keystore_password => "xxxxxx"
cacert => "xxxxxxxxxxxxx.crt"
}
}