Added multi sources for Http log file search.
This commit is contained in:
parent
3565c1024b
commit
52090b3637
2 changed files with 94 additions and 2 deletions
|
@ -397,6 +397,37 @@ public class Configuration extends PathPropertyList
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -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.
|
||||
*
|
||||
|
@ -23,6 +23,8 @@ import java.util.regex.Pattern;
|
|||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import fr.devinsy.strings.StringList;
|
||||
|
||||
/**
|
||||
* The Class FilesUtils.
|
||||
*/
|
||||
|
@ -117,7 +119,11 @@ public class FilesUtils
|
|||
|
||||
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.
|
||||
File parent = null;
|
||||
|
@ -156,6 +162,61 @@ public class FilesUtils
|
|||
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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue