Sub CreateHourlySummary()
    Dim rawDataSheet As Worksheet
    Dim summarySheet As Worksheet
    Dim lastRow As Long
    Dim lastCol As Long
    Dim i As Long
    Dim j As Long
    
    ' Ajouter une nouvelle feuille pour les données brutes
    Set rawDataSheet = Worksheets.Add(After:=ActiveSheet)
    rawDataSheet.Name = "Raw Data"
    
    ' Importer le fichier CSV dans la feuille de données brutes
    With rawDataSheet.QueryTables.Add(Connection:="TEXT;" & Application.GetOpenFilename(FileFilter:="CSV Files (*.csv),*.csv"), Destination:=rawDataSheet.Range("A1"))
        .TextFileParseType = xlDelimited
        .TextFileCommaDelimiter = True
        .Refresh
    End With
    
    ' Ajouter une nouvelle feuille pour le tableau récapitulatif
    Set summarySheet = Worksheets.Add(After:=rawDataSheet)
    summarySheet.Name = "Hourly Summary"
    
    ' Ajouter les en-têtes de colonnes pour chaque heure
    For i = 0 To 23
        summarySheet.Cells(1, i + 2).Value = Format(i, "00") & ":00"
    Next i
    summarySheet.Cells(1, 1).Value = "Date"
    
    ' Trouver la dernière ligne et la dernière colonne des données brutes
    lastRow = rawDataSheet.Cells(rawDataSheet.Rows.Count, 1).End(xlUp).Row
    lastCol = rawDataSheet.Cells(1, rawDataSheet.Columns.Count).End(xlToLeft).Column
    
    ' Boucle à travers les données brutes et compter les hits pour chaque heure
    For i = 2 To lastRow
        Dim dateVal As Date
        dateVal = CDate(Left(rawDataSheet.Cells(i, 1).Value, 10))
        
        If Application.CountIf(summarySheet.Columns(1), dateVal) = 0 Then
            summarySheet.Cells(summarySheet.Rows.Count, 1).End(xlUp).Offset(1).Value = dateVal
        End If
        
        Dim hour As Integer
        hour = Hour(rawDataSheet.Cells(i, 1).Value)
        
        Dim summaryRow As Long
        summaryRow = Application.Match(dateVal, summarySheet.Columns(1), 0)
        
        summarySheet.Cells(summaryRow, hour + 2).Value = summarySheet.Cells(summaryRow, hour + 2).Value + 1
    Next i
    
    ' Formater le tableau récapitulatif
    With summarySheet
        .Rows(1).Font.Bold = True
        .Columns.AutoFit
    End With
    
    summarySheet.Activate
End Sub


@timestamp,"_id","_index","_score","agent.ephemeral_id","agent.id","agent.name","agent.type","agent.version","client.domain","client.geo.city_name","client.geo.continent_name","client.geo.country_iso_code","client.geo.country_name","client.geo.location","client.geo.region_iso_code","client.geo.region_name","client.ip","client.user.group.name","client.user.name","cloud.availability_zone","cloud.instance.id","cloud.provider","cloud.region","cloud.service.name","cs(User-Agent)","data_stream.dataset","data_stream.namespace","data_stream.type","destination.ip","destination.ipm.block","destination.ipm.class","destination.ipm.name","destination.ipm.site","destination.ipm.subnet","ecs.version","elastic_agent.id","elastic_agent.snapshot","elastic_agent.version","event.action","event.agent_id_status","event.category","event.dataset","event.id","event.ingested","event.kind","event.outcome","event.reason","event.type","host.architecture","host.containerized","host.hostname","host.id","host.ip","host.mac","host.name","host.os.codename","host.os.family","host.os.kernel","host.os.name","host.os.platform","host.os.type","host.os.version","http.request.body.icap","http.request.bytes","http.request.method","http.request.referer","http.response.body.icap","http.response.bytes","http.response.mime_type","http.response.status_code","input.type","log.source.address",message,"observer.domain","observer.domain.text","observer.ip","related.hosts","related.ip","server.ip","server.ipm.block","server.ipm.class","server.ipm.name","server.ipm.site","server.ipm.subnet","sgos.time-taken","source.domain","source.geo.city_name","source.geo.continent_name","source.geo.country_iso_code","source.geo.country_name","source.geo.location","source.geo.region_iso_code","source.geo.region_name","source.ip","source.user.group.name","source.user.name","url.domain","url.extension","url.full","url.path","url.port","url.query","url.scheme","user_agent.device.name","user_agent.name","user_agent.original","user_agent.original.text","user_agent.os.full","user_agent.os.full.text","user_agent.os.name","user_agent.os.version","user_agent.version","x-virus-id"																		
Mar 31, 2024 @ 22:16:54.000,xBcqlo4ByVELpIfqFh7m,".ds-logs-sgos.access-prod-2024.03.17-000021","-","7c738332-528d-46bf-bf68-c08c3fe18866","f27bdb1c-61eb-4e5b-9334-e824c2af2713",lx05061p,filebeat,"8.8.1","-","-",Europe,GB,"United Kingdom","POINT (-0.1224 51.4964)","-","-","185.191.171.1","-","-","eu-west-0c","c46444d9-7427-439e-acca-81ef60e2fcef",huawei,"(empty)",ECS,"Mozilla/5.0 (compatible	 SemrushBot/7~bl	 +http://www.semrush.com/bot.html)","sgos.access",prod,logs,"10.238.73.75","DC VdR - Val-de-Reuil - OBS-IT - HQ2E",Server,"vs300-farm-domino-75.dc.uro.equant.com","Equant Intranet","OBSIT VDR - Bigip PELAGOS Farms","8.0.0","f27bdb1c-61eb-4e5b-9334-e824c2af2713",false,"8.8.1","TCP_NC_MISS",verified,web,"sgos.access","1afd0fd740e90a7d-000000002c0bef03-000000006609c4b1","Mar 31, 2024 @ 22:18:44.000",event,success,"-",access,"x86_64",false,lx05061p,836606b8bdf347b4819a98eff14bae42,"10.235.82.8, fe80::f816:3eff:fe4d:b46a","FA-16-3E-4D-B4-6A",lx05061p,"Green Obsidian",redhat,"4.18.0-372.13.1.el8_6.x86_64","Rocky Linux",rocky,linux,"8.6 (Green Obsidian)","-",228,GET,"-","-","12,188","text/html	%20charset=UTF-8",200,tcp,"100.125.22.51:11964","2024-03-31 20:16:54 201 185.191.171.1 - - - PROXIED ""none"" - 200 TCP_NC_MISS GET text/html	%20charset=UTF-8 https clstx0304-i.equant.com 443 /nuar/nuarweb_cp.nsf - nsf ""Mozilla/5.0 (compatible	 SemrushBot/7~bl	 +http://www.semrush.com/bot.html)"" 194.2.70.248 12188 228 - ""unavailable"" ""unavailable"" - ""stork1"" 10.238.73.75 1afd0fd740e90a7d-000000002c0bef03-000000006609c4b1 - -",stork1,stork1,"194.2.70.248","clstx0304-i.equant.com, stork1","10.235.82.8, fe80::f816:3eff:fe4d:b46a, 185.191.171.1, 194.2.70.248, 10.238.73.75","10.238.73.75","DC VdR - Val-de-Reuil - OBS-IT - HQ2E",Server,"vs300-farm-domino-75.dc.uro.equant.com","Equant Intranet","OBSIT VDR - Bigip PELAGOS Farms",201,"-","-",Europe,GB,"United Kingdom","POINT (-0.1224 51.4964)","-","-","185.191.171.1","-","-","clstx0304-i.equant.com",nsf,"https://clstx0304-i.equant.com:443/nuar/nuarweb_cp.nsf","/nuar/nuarweb_cp.nsf",443,"-",https,Spider,SemrushBot,"Mozilla/5.0 (compatible	 SemrushBot/7~bl	 +http://www.semrush.com/bot.html)","Mozilla/5.0 (compatible	 SemrushBot/7~bl	 +http://www.semrush.com/bot.html)","-","-","-","-",7,"-"								
Mar 31, 2024 @ 21:53:41.000,"VBYUlo4ByVELpIfqo_C7",".ds-logs-sgos.access-prod-2024.03.17-000021","-","5d1c9eb4-ade7-4544-bc9e-489db019280f","f27bdb1c-61eb-4e5b-9334-e824c2af2713",lx05061p,filebeat,"8.8.1","-","-","North America",US,"United States","POINT (-97.822 37.751)","-","-","66.249.75.199","-","-","eu-west-0c","c46444d9-7427-439e-acca-81ef60e2fcef",huawei,"(empty)",ECS,"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko	 compatible	 Googlebot/2.1	 +http://www.google.com/bot.html) Chrome/122.0.6261.94 Safari/537.36","sgos.access",prod,logs,"10.238.73.75","DC VdR - Val-de-Reuil - OBS-IT - HQ2E",Server,"vs300-farm-domino-75.dc.uro.equant.com","Equant Intranet","OBSIT VDR - Bigip PELAGOS Farms","8.0.0","f27bdb1c-61eb-4e5b-9334-e824c2af2713",false,"8.8.1","TCP_NC_MISS",verified,web,"sgos.access","1afd0fd740e90a7d-000000002c0be9a2-000000006609bf45","Mar 31, 2024 @ 21:55:18.000",event,success,"-",access,"x86_64",false,lx05061p,836606b8bdf347b4819a98eff14bae42,"10.235.82.8, fe80::f816:3eff:fe4d:b46a","FA-16-3E-4D-B4-6A",lx05061p,"Green Obsidian",redhat,"4.18.0-372.13.1.el8_6.x86_64","Rocky Linux",rocky,linux,"8.6 (Green Obsidian)","-",733,GET,"https://www.nuar.fr.orange-business.com/nuar/nuarweb_cp.nsf","-","2,443","text/html	%20charset=UTF-8",200,tcp,"100.125.22.58:11964","2024-03-31 19:53:41 17 66.249.75.199 - - - PROXIED ""none"" https://www.nuar.fr.orange-business.com/nuar/nuarweb_cp.nsf 200 TCP_NC_MISS GET text/html	%20charset=UTF-8 https clstx0304-i.equant.com 443 /portaleq.nsf/mLockout ?OpenForm - ""Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko	 compatible	 Googlebot/2.1	 +http://www.google.com/bot.html) Chrome/122.0.6261.94 Safari/537.36"" 194.2.70.248 2443 733 - ""unavailable"" ""unavailable"" - ""stork1"" 10.238.73.75 1afd0fd740e90a7d-000000002c0be9a2-000000006609bf45 - -",stork1,stork1,"194.2.70.248","clstx0304-i.equant.com, stork1","10.235.82.8, fe80::f816:3eff:fe4d:b46a, 66.249.75.199, 194.2.70.248, 10.238.73.75","10.238.73.75","DC VdR - Val-de-Reuil - OBS-IT - HQ2E",Server,"vs300-farm-domino-75.dc.uro.equant.com","Equant Intranet","OBSIT VDR - Bigip PELAGOS Farms",17,"-","-","North America",US,"United States","POINT (-97.822 37.751)","-","-","66.249.75.199","-","-","clstx0304-i.equant.com","-","https://clstx0304-i.equant.com:443/portaleq.nsf/mLockout?OpenForm","/portaleq.nsf/mLockout",443,"?OpenForm",https,Spider,Googlebot,"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko	 compatible	 Googlebot/2.1	 +http://www.google.com/bot.html) Chrome/122.0.6261.94 Safari/537.36","Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko	 compatible	 Googlebot/2.1	 +http://www.google.com/bot.html) Chrome/122.0.6261.94 Safari/537.36","-","-","-","-","2.1","-"				
Mar 31, 2024 @ 21:53:36.000,"UhYUlo4ByVELpIfqo_C7",".ds-logs-sgos.access-prod-2024.03.17-000021","-","5d1c9eb4-ade7-4544-bc9e-489db019280f","f27bdb1c-61eb-4e5b-9334-e824c2af2713",lx05061p,filebeat,"8.8.1","-","-","North America",US,"United States","POINT (-97.822 37.751)","-","-","66.249.75.199","-","-","eu-west-0c","c46444d9-7427-439e-acca-81ef60e2fcef",huawei,"(empty)",ECS,"Mozilla/5.0 (compatible	 Googlebot/2.1	 +http://www.google.com/bot.html)","sgos.access",prod,logs,"10.238.73.75","DC VdR - Val-de-Reuil - OBS-IT - HQ2E",Server,"vs300-farm-domino-75.dc.uro.equant.com","Equant Intranet","OBSIT VDR - Bigip PELAGOS Farms","8.0.0","f27bdb1c-61eb-4e5b-9334-e824c2af2713",false,"8.8.1","TCP_NC_MISS",verified,web,"sgos.access","1afd0fd740e90a7d-000000002c0be99e-000000006609bf3b","Mar 31, 2024 @ 21:55:18.000",event,success,"-",access,"x86_64",false,lx05061p,836606b8bdf347b4819a98eff14bae42,"10.235.82.8, fe80::f816:3eff:fe4d:b46a","FA-16-3E-4D-B4-6A",lx05061p,"Green Obsidian",redhat,"4.18.0-372.13.1.el8_6.x86_64","Rocky Linux",rocky,linux,"8.6 (Green Obsidian)","-",319,GET,"-","-","12,193","text/html	%20charset=UTF-8",200,tcp,"100.125.22.58:11964","2024-03-31 19:53:36 244 66.249.75.199 - - - PROXIED ""none"" - 200 TCP_NC_MISS GET text/html	%20charset=UTF-8 https clstx0304-i.equant.com 443 /nuar/nuarweb_cp.nsf - nsf ""Mozilla/5.0 (compatible	 Googlebot/2.1	 +http://www.google.com/bot.html)"" 194.2.70.248 12193 319 - ""unavailable"" ""unavailable"" - ""stork1"" 10.238.73.75 1afd0fd740e90a7d-000000002c0be99e-000000006609bf3b - -",stork1,stork1,"194.2.70.248","clstx0304-i.equant.com, stork1","10.235.82.8, fe80::f816:3eff:fe4d:b46a, 66.249.75.199, 194.2.70.248, 10.238.73.75","10.238.73.75","DC VdR - Val-de-Reuil - OBS-IT - HQ2E",Server,"vs300-farm-domino-75.dc.uro.equant.com","Equant Intranet","OBSIT VDR - Bigip PELAGOS Farms",244,"-","-","North America",US,"United States","POINT (-97.822 37.751)","-","-","66.249.75.199","-","-","clstx0304-i.equant.com",nsf,"https://clstx0304-i.equant.com:443/nuar/nuarweb_cp.nsf","/nuar/nuarweb_cp.nsf",443,"-",https,Spider,Googlebot,"Mozilla/5.0 (compatible	 Googlebot/2.1	 +http://www.google.com/bot.html)","Mozilla/5.0 (compatible	 Googlebot/2.1	 +http://www.google.com/bot.html)","-","-","-","-","2.1","-"								
Mar 31, 2024 @ 21:45:12.000,"TRYNlo4ByVELpIfqCd_J",".ds-logs-sgos.access-prod-2024.03.17-000021","-","3ace888b-3805-4a32-8302-e31b680a7aac","f27bdb1c-61eb-4e5b-9334-e824c2af2713",lx05061p,filebeat,"8.8.1","-","Culver City","North America",US,"United States","POINT (-118.3983 34.0141)","US-CA",California,"165.85.174.156","-","-","eu-west-0c","c46444d9-7427-439e-acca-81ef60e2fcef",huawei,"(empty)",ECS,"Mozilla/5.0 (Windows NT 10.0	 Win64	 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36","sgos.access",prod,logs,"10.238.73.75","DC VdR - Val-de-Reuil - OBS-IT - HQ2E",Server,"vs300-farm-domino-75.dc.uro.equant.com","Equant Intranet","OBSIT VDR - Bigip PELAGOS Farms","8.0.0","f27bdb1c-61eb-4e5b-9334-e824c2af2713",false,"8.8.1","TCP_NC_MISS",verified,web,"sgos.access","1afd0fd740e90a7d-000000002c0be76a-000000006609bd48","Mar 31, 2024 @ 21:47:00.000",event,success,"-",access,"x86_64",false,lx05061p,836606b8bdf347b4819a98eff14bae42,"10.235.82.8, fe80::f816:3eff:fe4d:b46a","FA-16-3E-4D-B4-6A",lx05061p,"Green Obsidian",redhat,"4.18.0-372.13.1.el8_6.x86_64","Rocky Linux",rocky,linux,"8.6 (Green Obsidian)","-","1,189",GET,"https://www.nuar.fr.orange-business.com/nuar/nuarweb_cp.nsf","-",618,"image/gif",200,tcp,"100.125.22.60:11964","2024-03-31 19:45:12 15 165.85.174.156 - - - PROXIED ""none"" https://www.nuar.fr.orange-business.com/nuar/nuarweb_cp.nsf 200 TCP_NC_MISS GET image/gif https clstx0304-i.equant.com 443 /portaleq.nsf/tableLeft.gif - gif ""Mozilla/5.0 (Windows NT 10.0	 Win64	 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"" 194.2.70.248 618 1189 - ""unavailable"" ""unavailable"" - ""stork1"" 10.238.73.75 1afd0fd740e90a7d-000000002c0be76a-000000006609bd48 - -",stork1,stork1,"194.2.70.248","clstx0304-i.equant.com, stork1","10.235.82.8, fe80::f816:3eff:fe4d:b46a, 165.85.174.156, 194.2.70.248, 10.238.73.75","10.238.73.75","DC VdR - Val-de-Reuil - OBS-IT - HQ2E",Server,"vs300-farm-domino-75.dc.uro.equant.com","Equant Intranet","OBSIT VDR - Bigip PELAGOS Farms",15,"-","Culver City","North America",US,"United States","POINT (-118.3983 34.0141)","US-CA",California,"165.85.174.156","-","-","clstx0304-i.equant.com",gif,"https://clstx0304-i.equant.com:443/portaleq.nsf/tableLeft.gif","/portaleq.nsf/tableLeft.gif",443,"-",https,Other,Chrome,"Mozilla/5.0 (Windows NT 10.0	 Win64	 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36","Mozilla/5.0 (Windows NT 10.0	 Win64	 x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36","Windows 10","Windows 10",Windows,10,"123.0.0.0","-"										




Dim Hour As Integer
Hour = Hour(rawDataSheet.Cells(i, 1).Value): erreur tableau attendu