Added multi sources for Http log file search.

This commit is contained in:
Christian P. MOMON 2023-05-09 10:30:36 +02:00
parent 3565c1024b
commit 52090b3637
2 changed files with 94 additions and 2 deletions

View file

@ -397,6 +397,37 @@ public class Configuration extends PathPropertyList
return result; return result;
} }
/**
* Gets the probe http access log sources.
*
* @param source
* the source
* @return the probe http access log sources
*/
public StringList getProbeHttpAccessLogSources()
{
StringList result;
result = new StringList();
String source = getProbeHttpAccessLogSource();
if (StringUtils.isNotBlank(source))
{
String[] paths = source.split(",");
for (String path : paths)
{
if (StringUtils.isNotBlank(path))
{
result.add(StringUtils.trim(path));
}
}
}
//
return result;
}
/** /**
* Gets the probe http error log source. * Gets the probe http error log source.
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2020-2022 Christian Pierre MOMON <christian@momon.org> * Copyright (C) 2020-2023 Christian Pierre MOMON <christian@momon.org>
* *
* This file is part of StatoolInfos, simple service statistics tool. * This file is part of StatoolInfos, simple service statistics tool.
* *
@ -23,6 +23,8 @@ import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import fr.devinsy.strings.StringList;
/** /**
* The Class FilesUtils. * The Class FilesUtils.
*/ */
@ -117,7 +119,11 @@ public class FilesUtils
result = new Files(); result = new Files();
if (!StringUtils.isBlank(source)) if (StringUtils.contains(source, ','))
{
result.addAll(searchByWildcardFromMany(source));
}
else if (StringUtils.isNotBlank(source))
{ {
// Get the first parent without wildcard. // Get the first parent without wildcard.
File parent = null; File parent = null;
@ -156,6 +162,61 @@ public class FilesUtils
return result; return result;
} }
/**
* Search by wildcard.
*
* @param sources
* the sources
* @return the files
*/
public static Files searchByWildcard(final StringList sources)
{
Files result;
result = new Files();
if (sources != null)
{
for (String source : sources)
{
result.addAll(searchByWildcard(source));
}
}
//
return result;
}
/**
* Search by wildcard from many.
*
* @param source
* the source
* @return the files
*/
public static Files searchByWildcardFromMany(final String source)
{
Files result;
result = new Files();
if (StringUtils.isNotBlank(source))
{
String[] paths = source.split(",");
for (String path : paths)
{
if (StringUtils.isNotBlank(path))
{
result.addAll(searchByWildcard(StringUtils.trim(path)));
}
}
}
//
return result;
}
/** /**
* List recursively. * List recursively.
* *