Hi
Can You point me out how to use data filter to making correct timestamp from file, below data (already prepared in JSON format)
timestamp should be taken from "collectionBeginTime" field.
Thanks for help
{
"measFileHeader": {
"fileFormotVersion": "1",
"senderName": "Machine1",
"senderType": "",
"vendorName": "LB",
"collectionBeginTime": "202112300935Z"
},
"measData": [
{
"nEId": {
"nEUserName": "Proc1",
"nEDistinguishedNome": ""
},
"measInfo": [
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUT2.-.NNVALGBA": 0.0,
"AUT2.-.NAUSGSYNFAI": 34.0,
"AUT2.-.NNVALEPS": 0.0,
"AUT2.-.NAUSCSYNFAI": 252.0,
"AUT2.-.NQUIEPS": 159782.0,
"AUT2.-.NAUHSBSSYNFAI": 0.0,
"AUT2.-.NQUIGBA": 280.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUTHSUBS.-.SUBSTRIPL": 0.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUT.-.NAUTTRIPPRO": 3843.0,
"AUT.-.NAUTPARREU": 0.0,
"AUT.-.NAUREQQUINT": 440809.0,
"AUT.-.NAUTPARSEN": 0.0,
"AUT.-.NAUTPARMAP": 0.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUCSUBS.-.NSUBSCNT": 0.0,
"AUCSUBS.-.NUSUBSCNT": 0.0,
"AUCSUBS.-.NGSUBSCNT": 0.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"EVENTMAP.CANCLOC.NMAPTOT": 15935.0,
"EVENTMAP.CANCLOC.NMAPFLT": 0.0,
"EVENTMAP.CANCLOC.NMAPSUCC": 15934.0,
"EVENTMAP.UPDALOC.NMAPTOT": 19137.0,
"EVENTMAP.UPDALOC.NMAPSUCC": 19136.0
}
]
},
{
"nEId": {
"nEUserName": "Proc2",
"nEDistinguishedNome": ""
},
"measInfo": [
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUT2.-.NNVALGBA": 0.0,
"AUT2.-.NAUSGSYNFAI": 22.0,
"AUT2.-.NNVALEPS": 0.0,
"AUT2.-.NAUSCSYNFAI": 259.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUTHSUBS.-.SUBSTRIPL": 0.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUT.-.NAUTTRIPPRO": 3750.0,
"AUT.-.NAUTPARREU": 0.0,
"AUT.-.NAUREQQUINT": 441091.0,
"AUT.-.NAUTPARSEN": 0.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUCSUBS.-.NSUBSCNT": 0.0,
"AUCSUBS.-.NUSUBSCNT": 0.0,
"AUCSUBS.-.NGSUBSCNT": 0.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"EVENTMAP.EVENTMAPCANCLOC.NMAPTOT": 15910.0,
"EVENTMAP.CANCLOC.NMAPFLT": 0.0,
"EVENTMAP.CANCLOC.NMAPSUCC": 15913.0,
"EVENTMAP.UPDALOC.NMAPTOT": 19103.0
}
]
},
{
"nEId": {
"nEUserName": "Proc3",
"nEDistinguishedNome": ""
},
"measInfo": [
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUT2.-.NNVALGBA": 0.0,
"AUT2.-.NAUSGSYNFAI": 30.0,
"AUT2.-.NNVALEPS": 0.0,
"AUT2.-.NAUSCSYNFAI": 249.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUTHSUBS.-.SUBSTRIPL": 0.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUT.-.NAUTTRIPPRO": 3728.0,
"AUT.-.NAUTPARREU": 0.0,
"AUT.-.NAUREQQUINT": 441032.0,
"AUT.-.NAUTPARSEN": 0.0,
"AUT.-.NAUTPARMAP": 0.0,
"AUT.-.NAUTREQMAP": 0.0,
"AUT.-.NFAUTPS": 440754.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"AUCSUBS.-.NSUBSCNT": 0.0,
"AUCSUBS.-.NUSUBSCNT": 0.0,
"AUCSUBS.-.NGSUBSCNT": 0.0
},
{
"measStortTime": "202112300940Z",
"gronularityPeriod": 300,
"EVENTMAP.CANCLOC.NMAPTOT": 15727.0,
"EVENTMAP.CANCLOC.NMAPFLT": 0.0,
"EVENTMAP.CANCLOC.NMAPSUCC": 15729.0,
"EVENTMAP.UPDALOC.NMAPTOT": 18818.0,
"EVENTMAP.UPDALOC.NMAPSUCC": 18818.0,
"EVENTMAP.UPDALOC.NMAPFLT": 0.0
}
]
}
],
"measFileFooter": "202112300940Z"
}
my pipeline
input{
file {
codec => multiline { pattern => "^}" negate => true what => next max_lines => 20000 }
path => "/opt/data/input/test1.json"
sincedb_path => "/dev/null"
start_position => beginning
file_completed_action => "log"
file_completed_log_path => "/opt/data/logstash_files/fin_eir.log"
mode => read
}
}
filter{
mutate { gsub => ["message", "\n", ""] }
json{ source => "message" }
date {
match => ["collectionBeginTime", "yyyyMMddHHmmZ"]
timezone => "Europe/Paris"
target => "@timestamp"
}
mutate { remove_field => [ "measStortTime", "collectionBeginTime", "measFileFooter" ] }
split{ field => "measData" }
if "_jsonparsefailure" not in [tags] { mutate { remove_field => "message" } }
}
output{
stdout{ codec=>"rubydebug" }
}
and output
{
"tags" => [
[0] "multiline"
],
"path" => "/opt/data/input/test1.json",
"@timestamp" => 2022-11-14T21:29:36.077353Z,
"host" => "0.0.0.0",
"measFileHeader" => {
"fileFormotVersion" => "1",
"collectionBeginTime" => "202112300935Z",
"senderName" => "Machine1",
"vendorName" => "LB",
"senderType" => ""
},
"@version" => "1",
"measData" => {
"nEId" => {
"nEUserName" => "Proc1",
"nEDistinguishedNome" => ""
},
"measInfo" => [
[0] {
"gronularityPeriod" => 300,
"AUT2.-.NQUIGBA" => 280.0,
"AUT2.-.NAUSCSYNFAI" => 252.0,
"AUT2.-.NQUIEPS" => 159782.0,
"AUT2.-.NAUHSBSSYNFAI" => 0.0,
"AUT2.-.NNVALGBA" => 0.0,
"AUT2.-.NAUSGSYNFAI" => 34.0,
"AUT2.-.NNVALEPS" => 0.0,
"measStortTime" => "202112300940Z"
},
[1] {
"gronularityPeriod" => 300,
"measStortTime" => "202112300940Z",
"AUTHSUBS.-.SUBSTRIPL" => 0.0
},
[2] {
"gronularityPeriod" => 300,
"AUT.-.NAUREQQUINT" => 440809.0,
"AUT.-.NAUTPARSEN" => 0.0,
"AUT.-.NAUTTRIPPRO" => 3843.0,
"measStortTime" => "202112300940Z",
"AUT.-.NAUTPARREU" => 0.0,
"AUT.-.NAUTPARMAP" => 0.0
},
[3] {
"AUCSUBS.-.NUSUBSCNT" => 0.0,
"gronularityPeriod" => 300,
"AUCSUBS.-.NGSUBSCNT" => 0.0,
"measStortTime" => "202112300940Z",
"AUCSUBS.-.NSUBSCNT" => 0.0
},
[4] {
"EVENTMAP.CANCLOC.NMAPSUCC" => 15934.0,
"gronularityPeriod" => 300,
"EVENTMAP.UPDALOC.NMAPTOT" => 19137.0,
"EVENTMAP.CANCLOC.NMAPTOT" => 15935.0,
"EVENTMAP.UPDALOC.NMAPSUCC" => 19136.0,
"measStortTime" => "202112300940Z",
"EVENTMAP.CANCLOC.NMAPFLT" => 0.0
}
]
}
}
{
"tags" => [
[0] "multiline"
],
"path" => "/opt/data/input/test1.json",
"@timestamp" => 2022-11-14T21:29:36.077353Z,
"host" => "0.0.0.0",
"measFileHeader" => {
"fileFormotVersion" => "1",
"collectionBeginTime" => "202112300935Z",
"senderName" => "Machine1",
"vendorName" => "LB",
"senderType" => ""
},
"@version" => "1",
"measData" => {
"nEId" => {
"nEUserName" => "Proc2",
"nEDistinguishedNome" => ""
},
"measInfo" => [
[0] {
"gronularityPeriod" => 300,
"AUT2.-.NAUSCSYNFAI" => 259.0,
"AUT2.-.NNVALGBA" => 0.0,
"AUT2.-.NAUSGSYNFAI" => 22.0,
"AUT2.-.NNVALEPS" => 0.0,
"measStortTime" => "202112300940Z"
},
[1] {
"gronularityPeriod" => 300,
"measStortTime" => "202112300940Z",
"AUTHSUBS.-.SUBSTRIPL" => 0.0
},
[2] {
"gronularityPeriod" => 300,
"AUT.-.NAUREQQUINT" => 441091.0,
"AUT.-.NAUTPARSEN" => 0.0,
"AUT.-.NAUTTRIPPRO" => 3750.0,
"measStortTime" => "202112300940Z",
"AUT.-.NAUTPARREU" => 0.0
},
[3] {
"AUCSUBS.-.NUSUBSCNT" => 0.0,
"gronularityPeriod" => 300,
"AUCSUBS.-.NGSUBSCNT" => 0.0,
"measStortTime" => "202112300940Z",
"AUCSUBS.-.NSUBSCNT" => 0.0
},
[4] {
"EVENTMAP.CANCLOC.NMAPSUCC" => 15913.0,
"gronularityPeriod" => 300,
"EVENTMAP.UPDALOC.NMAPTOT" => 19103.0,
"EVENTMAP.EVENTMAPCANCLOC.NMAPTOT" => 15910.0,
"measStortTime" => "202112300940Z",
"EVENTMAP.CANCLOC.NMAPFLT" => 0.0
}
]
}
}
{
"tags" => [
[0] "multiline"
],
"path" => "/opt/data/input/test1.json",
"@timestamp" => 2022-11-14T21:29:36.077353Z,
"host" => "0.0.0.0",
"measFileHeader" => {
"fileFormotVersion" => "1",
"collectionBeginTime" => "202112300935Z",
"senderName" => "Machine1",
"vendorName" => "LB",
"senderType" => ""
},
"@version" => "1",
"measData" => {
"nEId" => {
"nEUserName" => "Proc3",
"nEDistinguishedNome" => ""
},
"measInfo" => [
[0] {
"gronularityPeriod" => 300,
"AUT2.-.NAUSCSYNFAI" => 249.0,
"AUT2.-.NNVALGBA" => 0.0,
"AUT2.-.NAUSGSYNFAI" => 30.0,
"AUT2.-.NNVALEPS" => 0.0,
"measStortTime" => "202112300940Z"
},
[1] {
"gronularityPeriod" => 300,
"measStortTime" => "202112300940Z",
"AUTHSUBS.-.SUBSTRIPL" => 0.0
},
[2] {
"gronularityPeriod" => 300,
"AUT.-.NFAUTPS" => 440754.0,
"AUT.-.NAUREQQUINT" => 441032.0,
"AUT.-.NAUTPARSEN" => 0.0,
"AUT.-.NAUTTRIPPRO" => 3728.0,
"AUT.-.NAUTREQMAP" => 0.0,
"measStortTime" => "202112300940Z",
"AUT.-.NAUTPARREU" => 0.0,
"AUT.-.NAUTPARMAP" => 0.0
},
[3] {
"AUCSUBS.-.NUSUBSCNT" => 0.0,
"gronularityPeriod" => 300,
"AUCSUBS.-.NGSUBSCNT" => 0.0,
"measStortTime" => "202112300940Z",
"AUCSUBS.-.NSUBSCNT" => 0.0
},
[4] {
"EVENTMAP.CANCLOC.NMAPSUCC" => 15729.0,
"gronularityPeriod" => 300,
"EVENTMAP.UPDALOC.NMAPTOT" => 18818.0,
"EVENTMAP.CANCLOC.NMAPTOT" => 15727.0,
"EVENTMAP.UPDALOC.NMAPSUCC" => 18818.0,
"EVENTMAP.UPDALOC.NMAPFLT" => 0.0,
"measStortTime" => "202112300940Z",
"EVENTMAP.CANCLOC.NMAPFLT" => 0.0
}
]
}
}