Getting Data In

Parsing appended Robocopy job logs

anewell
Path Finder

Has anybody dealt with splunking Windows Robocopy.exe logs? I'm about to dive into it, and am looking for prior art. My input files are created by scheduled robocopy jobs which append their logs to the file. I think I'm dealing with a SHOULD_LINEMERGE and needing to decide on a LINEBREAKER.

Edit: My primary goal is to be able to report & graph the "Bytes copied" and job duration values over time. In the example below, the value I'm after is 741.88 m but I'd be thrilled to extract more than that.

The first 3 lines are produced by the batch script which calls Robocopy. Lines 4 onward are robocopy itself. Indexing lines 1-3 may be ignored for purposes of arriving at a generalized robocopy solution.

================================================= 
Servername 
================================================= 
-------------------------------------------------------------------------------
   ROBOCOPY     ::     Robust File Copy for Windows     ::     Version XP010
-------------------------------------------------------------------------------

  Started : Tue Mar 01 10:00:01 2011

   Source : \\Servername\DATA\
     Dest : D:\BACKUPS\

    Files : *.*

  Options : *.* /NS /NC /NDL /NFL /S /E /COPY:DATS /PURGE /NP /R:0 /W:30 

------------------------------------------------------------------------------

                D:\BACKUPS\file1.txt
                D:\BACKUPS\file2.txt
                D:\BACKUPS\file3.dat
                # SNIP #
                D:\BACKUPS\fileN.bak


------------------------------------------------------------------------------

                Total    Copied   Skipped  Mismatch    FAILED    Extras
     Dirs :      1801         3      1798         0         0         0
    Files :     90133      3366     86767         0         0      1210
    Bytes :  24.011 g  741.88 m  23.286 g         0         0  157.96 m
    Times :   0:07:18   0:03:53                       0:00:00   0:03:25

    Speed :             3333995 Bytes/sec.
    Speed :             190.772 MegaBytes/min.

    Ended : Tue Mar 01 10:07:20 2011
0 Karma

gkanapathy
Splunk Employee
Splunk Employee

I would suggest the entire log here as a single event, then using extractions and/or multikv to get out the values you want. So

[robocopy]
SHOULD_LINEMERGE = false
TRUNCATE = 0
LINE_BREAKER = ([\r\n]+)(?=-{79}[\r\n]+\s+ROBOCOPY)
TIME_PREFIX = Started\s+:\s*
TIME_FORMAT = %a %b %d %H:%M:%S %Y
MAX_TIMESTAMP_LOOKAHEAD = 40
EXTRACT-bytes = [\r\n]+\s*Bytes\s+:\s+(?<bytestotal>[\d\.]+)\s*(?<bytestotalunits>[kmgtKMGT])?\s+(?<bytescopied>[\d\.]+)\s*(?<bytescopiedunits)[kmgtKMGT])?

If each job run is in a separate file, you could also use LINE_BREAKER = (?!), which means it will never break and the whole file is a single event.

Get Updates on the Splunk Community!

AI for AppInspect

We’re excited to announce two new updates to AppInspect designed to save you time and make the app approval ...

App Platform's 2025 Year in Review: A Year of Innovation, Growth, and Community

As we step into 2026, it’s the perfect moment to reflect on what an extraordinary year 2025 was for the Splunk ...

Operationalizing Entity Risk Score with Enterprise Security 8.3+

Overview Enterprise Security 8.3 introduces a powerful new feature called “Entity Risk Scoring” (ERS) for ...