Improved CLI commands.
This commit is contained in:
parent
af0ee48e4b
commit
2ec1b2e926
2 changed files with 93 additions and 38 deletions
|
@ -116,14 +116,14 @@ public final class StatoolInfosCLI
|
|||
message.appendln(" statoolinfos tagdate <fileordirectory> update the file.datetime file");
|
||||
message.appendln(" statoolinfos uptime <configurationfile> update uptime journal");
|
||||
message.appendln();
|
||||
message.appendln(" statoolinfos list files <filesorconfigfile> display http access log files");
|
||||
message.appendln(" statoolinfos list logs [-bot|-nobot] <filesorconfigfile> display http access log lines");
|
||||
message.appendln(" statoolinfos list ip [-bot|-nobot] <fileordirectory> generate ip list from http log file");
|
||||
message.appendln(" statoolinfos list ua [-bot|-nobot] <fileordirectory> generate user agent list from http log file");
|
||||
message.appendln(" statoolinfos list visitors [-bot|-nobot] <fileordirectory> generate visitors (ip+ua) list from http log file");
|
||||
message.appendln(" statoolinfos stat ip [-bot|-nobot] <fileordirectory> generate stats about ip from http log file");
|
||||
message.appendln(" statoolinfos stat ua [-bot|-nobot] <fileordirectory> generate stats about user agent from http log file");
|
||||
message.appendln(" statoolinfos stat visitors [-bot|-nobot] <fileordirectory> generate stats about visitors (ip+ua) from http log file");
|
||||
message.appendln(" statoolinfos list files <logfilesorconfigfile> display http access log files");
|
||||
message.appendln(" statoolinfos list logs [-bot|-nobot] <logfilesorconfigfile> display http access log lines");
|
||||
message.appendln(" statoolinfos list ip [-bot|-nobot] <logfiles> generate ip list from http log file");
|
||||
message.appendln(" statoolinfos list ua [-bot|-nobot] <logfiles> generate user agent list from http log file");
|
||||
message.appendln(" statoolinfos list visitors [-bot|-nobot] <logfiles> generate visitors (ip+ua) list from http log file");
|
||||
message.appendln(" statoolinfos stat ip [-bot|-nobot] <logfiles> generate stats about ip from http log file");
|
||||
message.appendln(" statoolinfos stat ua [-bot|-nobot] <logfiles> generate stats about user agent from http log file");
|
||||
message.appendln(" statoolinfos stat visitors [-bot|-nobot] <logfiles> generate stats about visitors (ip+ua) from http log file");
|
||||
|
||||
System.out.print(message.toString());
|
||||
}
|
||||
|
@ -313,86 +313,116 @@ public final class StatoolInfosCLI
|
|||
}
|
||||
System.out.println(chrono.format());
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "ip", "\\s*\\S+\\s*"))
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "ip", "\\s*\\S+\\s*"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
Files files = new Files();
|
||||
for (int source = 2; source < args.length; source++)
|
||||
{
|
||||
files.add(new File(args[source]));
|
||||
}
|
||||
|
||||
StatoolInfos.listIps(source, BotFilter.ALL);
|
||||
StatoolInfos.listIps(files, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "ip", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listIps(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "files", "\\s*.+\\.conf\\s*"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listFiles(configurationFile);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "files", "\\s*\\S+\\s*"))
|
||||
{
|
||||
Files files = new Files();
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
files.add(new File(args[index]));
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
StatoolInfos.listFiles(files);
|
||||
|
||||
StatoolInfos.listFiles(source);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "logs", "\\s*.+\\.conf\\s*"))
|
||||
{
|
||||
File configurationFile = new File(StringUtils.trim(args[2]));
|
||||
|
||||
StatoolInfos.listLogs(configurationFile, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "logs", "(-all|-bot|-nobot)", "\\s*.+\\.conf\\s*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File configurationFile = new File(StringUtils.trim(args[3]));
|
||||
|
||||
StatoolInfos.listLogs(configurationFile, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "logs", "\\s*\\S+\\s*"))
|
||||
{
|
||||
Files files = new Files();
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
files.add(new File(args[index]));
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
StatoolInfos.listLogs(files, BotFilter.ALL);
|
||||
|
||||
StatoolInfos.listLogs(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatchingEllipsis(args, "list", "logs", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
Files files = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
files.add(new File(args[index]));
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
StatoolInfos.listLogs(files, filter);
|
||||
|
||||
StatoolInfos.listLogs(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(useragent|ua)", "\\s*\\S+\\s*"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listUserAgents(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "(useragent|ua)", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listUserAgents(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "visitors", "\\s*\\S+\\s*"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listVisitors(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "list", "visitors", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.listVisitors(source, filter);
|
||||
}
|
||||
|
@ -451,39 +481,64 @@ public final class StatoolInfosCLI
|
|||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "ip", "\\s*\\S+\\s*"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statIps(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "ip", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statIps(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "(useragent|ua)", "\\s*\\S+\\s*"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statUserAgents(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "(useragent|ua)", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statUserAgents(source, filter);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "visitors", "\\s*\\S+\\s*"))
|
||||
{
|
||||
File source = new File(args[2]);
|
||||
Files source = new Files();
|
||||
for (int index = 2; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statVisitors(source, BotFilter.ALL);
|
||||
}
|
||||
else if (CLIUtils.isMatching(args, "stat", "visitors", "(-all|-bot|-nobot)", "\\s*\\S+\\s*"))
|
||||
{
|
||||
BotFilter filter = parseLogFilterOption(args[2]);
|
||||
File source = new File(args[3]);
|
||||
Files source = new Files();
|
||||
for (int index = 3; index < args.length; index++)
|
||||
{
|
||||
source.add(new File(args[index]));
|
||||
}
|
||||
|
||||
StatoolInfos.statVisitors(source, filter);
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ public class StatoolInfos
|
|||
* the source
|
||||
* @throws IOException
|
||||
*/
|
||||
public static void listIps(final File source, final BotFilter filter)
|
||||
public static void listIps(final Files source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -367,7 +367,7 @@ public class StatoolInfos
|
|||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void listUserAgents(final File source, final BotFilter filter)
|
||||
public static void listUserAgents(final Files source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -415,7 +415,7 @@ public class StatoolInfos
|
|||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void listVisitors(final File source, final BotFilter filter)
|
||||
public static void listVisitors(final Files source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -478,7 +478,7 @@ public class StatoolInfos
|
|||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void statIps(final File source, final BotFilter filter)
|
||||
public static void statIps(final Files source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -527,7 +527,7 @@ public class StatoolInfos
|
|||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void statUserAgents(final File source, final BotFilter filter)
|
||||
public static void statUserAgents(final Files source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -576,7 +576,7 @@ public class StatoolInfos
|
|||
* @param source
|
||||
* the source
|
||||
*/
|
||||
public static void statVisitors(final File source, final BotFilter filter)
|
||||
public static void statVisitors(final Files source, final BotFilter filter)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue