import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.io.IOUtils;

import dk.netarkivet.common.utils.FileUtils;
import dk.netarkivet.viewerproxy.webinterface.Reporting;


public class ExtractCrawlogsForSpecificDomains {

    /**
     * @param args A resultfile generated by the tool FindDomainsForCrawllogExtraction
     * @throws FileNotFoundException 
     */
    public static void main(String[] args) throws FileNotFoundException {
        if (args.length != 2) {
            System.err.println("Missing argument: ExtractCrawlogsForSpecificDomains <filename> <#jobs pr domain>");
            System.exit(1);
        }
        int numberofjobs = 0;
        try {
            numberofjobs = Integer.parseInt(args[1]);
            if (numberofjobs <= 0) {
                System.err.println("The given jobs pr domain value '" + numberofjobs 
                        + "' is not a positive integer");
                System.exit(1);
            }
        } catch (NumberFormatException e){
           System.err.println("The given jobs pr domain value '" + args[1] 
                   + "' could not be identified as a positive integer.");
           System.exit(1);
        }
        
        File f = new File(args[0]);
        if (!f.exists()) {
            System.err.println("The filename given '" + f.getAbsolutePath() + "' does not exist");
            System.exit(1);
        }
        BufferedReader br = null;
        String line = null;
        try {
            br = new BufferedReader(new FileReader(f));
            while ((line = br.readLine()) != null) {
                processLine(line, numberofjobs);
            }
        } catch (Throwable e) {
            e.printStackTrace();
        } finally {
            IOUtils.closeQuietly(br);
        }
    }

    private static void processLine(String line, int numberofjobsexpected) {
        // 'shopcamp.dk' ('defaultconfig': 144695 (oc=151, bc=4973939),151261 (oc=164, 
        // bc=5151849),159663 (oc=179, bc=6726790),166196 (oc=179, bc=6725192)
        String[] lineparts = line.split(":");
        String domainConfigPart = null;
        if (lineparts.length != 2) {
            System.err.println("Skipping line '" + line + "'");
            return;
        }
        
        domainConfigPart = lineparts[0];
        String[] domainNameParts = domainConfigPart.split(" ");
        String domainName = domainNameParts[0].substring(1, domainNameParts[0].length() - 1);
        String jobIDpart = lineparts[1].trim();
        String[] jobIDparts = jobIDpart.split("\\),");
        if (jobIDparts.length != numberofjobsexpected) {
            System.err.println("Skipping line '" + line 
                    + "': wrong number of jobs found: " +  jobIDparts.length + " and not as expected " 
                    + numberofjobsexpected);
            return;
        }
        System.out.println("domain: " + domainName);
        List<Integer> jobs = new ArrayList<Integer>();
        for (String j: jobIDparts) {
            //System.out.println("j: " + j);
            Integer i = Integer.parseInt(j.split(" ")[0].trim());
            //System.out.println("found jobID: " + i);
            jobs.add(i);
        }
        
        if (jobs.size() != numberofjobsexpected) {
            System.err.println("Something went wrong. Only got #jobs: " +  jobs.size() 
                    + " but expected " + numberofjobsexpected);
            return;
        }
        String nameSuffix = "_crawlog.txt";
        System.out.println("Fetching crawl-logs for domain: " + domainName);
        for (Integer jobid: jobs) {
            File result = Reporting.getCrawlLogForDomainInJob(domainName, jobid);
            if (result != null && result.length() > 0) {
                // Copy data to file domainname_jobid_crawlog.txt
                File outputFile = new File(domainName + "_" + jobid + nameSuffix);
                FileUtils.copyFile(result, outputFile);
            } else {
                System.err.println("No data received for domain '" + domainName 
                        + "' from result of harvest job '" + jobid + "'");
            }
        }
    }

}

Work on script for extracting crawlogs for specific domains from a series of harvestjobs