Gather information from LOG file

Tagged: 

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Venkata Kalyan Venkata Kalyan 2 months, 3 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45636
    Profile photo of Venkata Kalyan
    Venkata Kalyan
    Participant

    Hi,

    I have a log file, which contains the below information:

    ERROR 2016-07-03 23:30:57,338 schedulerFactory_Worker-9 com.efi.printsmith.franchisee.util.AggregationStatus – ##################### Aggregation Status #########################
    ERROR 2016-07-03 23:30:57,338 schedulerFactory_Worker-9 com.efi.printsmith.franchisee.util.AggregationStatus – ####### Aggregation Start Time – 2016-07-03 22.30.00
    ERROR 2016-07-03 23:30:57,338 schedulerFactory_Worker-9 com.efi.printsmith.franchisee.util.AggregationStatus – ####### Aggregation End Time – 2016-07-03 23.30.57
    ERROR 2016-07-03 23:30:57,338 schedulerFactory_Worker-9 com.efi.printsmith.franchisee.util.AggregationStatus – ####### Total Duration took to drop index – 876
    ERROR 2016-07-03 23:30:57,338 schedulerFactory_Worker-9 com.efi.printsmith.franchisee.util.AggregationStatus – ####### Total Duration took to recreate index – 17468
    ERROR 2016-07-03 23:30:57,338 schedulerFactory_Worker-9 com.efi.printsmith.franchisee.util.AggregationStatus – ####### Total Number of tables aggregated – 292
    ERROR 2016-07-03 23:30:57,338 schedulerFactory_Worker-9 com.efi.printsmith.franchisee.util.AggregationStatus – ####### Time taken for whole process – 3657330
    ERROR 2016-07-03 23:30:57,338 schedulerFactory_Worker-9 com.efi.printsmith.franchisee.util.AggregationStatus – ##################################################################

    I need to get only Aggregation Start Time – 2016-07-03 22.30.00, Aggregation End Time – 2016-07-03 23.30.57, Time taken for whole process – 3657330 to a text file.

    -Kalyan

    • This topic was modified 2 months, 3 weeks ago by Profile photo of Venkata Kalyan Venkata Kalyan. Reason: Subject wrong
    #45659
    Profile photo of random commandline
    random commandline
    Participant
    $log = Get-ChildItem \\path\to\logfile
    $results = switch -Regex -File $log {
        'Aggregation (Start|End) .*' {$Matches[0]}
        'Time taken .*' {$Matches[0]}
    }
    
    $results | Out-File \\path\to\logresults.txt
    
    #45902
    Profile photo of Venkata Kalyan
    Venkata Kalyan
    Participant

    Thanks.

    -Kalyan

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.