Compare commits

...

3 Commits

5 changed files with 36 additions and 35 deletions

View File

@ -61,8 +61,6 @@ public final class Logar
* *
* @param source * @param source
* the source * the source
* @param target
* the target
*/ */
public static void anonymize(final File source) public static void anonymize(final File source)
{ {
@ -74,8 +72,8 @@ public final class Logar
* *
* @param source * @param source
* the source * the source
* @param target * @param mapFile
* the target * the map file
*/ */
public static void anonymize(final File source, final File mapFile) public static void anonymize(final File source, final File mapFile)
{ {
@ -421,11 +419,12 @@ public final class Logar
} }
/** /**
* Check sort for access files. * Check sort file.
* *
* @param source * @param file
* the source * the file
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void checkSortFile(final File file) throws IOException public static void checkSortFile(final File file) throws IOException
{ {
@ -510,10 +509,10 @@ public final class Logar
} }
/** /**
* Check concate on file. * Test concate file.
* *
* @param source * @param file
* the source * the file
*/ */
public static void testConcateFile(final File file) public static void testConcateFile(final File file)
{ {

View File

@ -108,8 +108,8 @@ public final class AnonMapFile
/** /**
* Save. * Save.
* *
* @param source * @param target
* the source * the target
* @param map * @param map
* the map * the map
*/ */

View File

@ -65,8 +65,6 @@ public final class Anonymizer
* *
* @param source * @param source
* the source * the source
* @param target
* the target
*/ */
public void anonymize(final File source) public void anonymize(final File source)
{ {

View File

@ -184,12 +184,16 @@ public final class LogFile
} }
/** /**
* Save access log. * Save logs.
* *
* @param source * @param target
* the source * the target
* @throws IOException * @param logs
* the logs
* @throws FileNotFoundException * @throws FileNotFoundException
* the file not found exception
* @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void saveLogs(final File target, final Logs logs) throws FileNotFoundException, IOException public static void saveLogs(final File target, final Logs logs) throws FileNotFoundException, IOException
{ {
@ -217,11 +221,12 @@ public final class LogFile
} }
/** /**
* Sort access log. * Sort log file.
* *
* @param target * @param file
* the target * the file
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred.
*/ */
public static void sortLogFile(final File file) throws IOException public static void sortLogFile(final File file) throws IOException
{ {

View File

@ -56,11 +56,10 @@ public final class LogarCLI
message.appendln(" logar [ -h | -help | --help ]"); message.appendln(" logar [ -h | -help | --help ]");
message.appendln(" logar [ -v | -version | --version ]"); message.appendln(" logar [ -v | -version | --version ]");
message.appendln(" logar anonymize fileordirectory [mapfile] anonymize ip and user"); message.appendln(" logar anonymize fileordirectory [mapfile] anonymize ip and user");
message.appendln(" logar archive source target archive previous month from /var/log/nginx/ tree"); message.appendln(" logar archive [-dry] source target archive previous month from /var/log/nginx/ tree");
message.appendln(" logar check fileordirectory check line format in log file"); message.appendln(" logar check fileordirectory check line format in log file");
message.appendln(" logar checksort fileordirectory check sort in log file"); message.appendln(" logar checksort fileordirectory check sort in log file");
message.appendln(" logar sort fileordirectory sort log files by datetime"); message.appendln(" logar sort fileordirectory sort log files by datetime");
message.appendln(" logar testarchive source test archive without writing");
message.appendln(" logar testconcate fileordirectory test line concate in log file"); message.appendln(" logar testconcate fileordirectory test line concate in log file");
logger.info(message.toString()); logger.info(message.toString());
@ -205,6 +204,13 @@ public final class LogarCLI
Logar.archive(source, target, DryOption.OFF); Logar.archive(source, target, DryOption.OFF);
} }
else if (isMatching(args, "archive", "-dry", "\\s*\\S+\\s*", "\\s*\\S+\\s*"))
{
File source = new File(args[2]);
File target = new File(args[3]);
Logar.archive(source, target, DryOption.ON);
}
else if (isMatching(args, "check", "\\s*\\S+\\s*")) else if (isMatching(args, "check", "\\s*\\S+\\s*"))
{ {
File source = new File(args[1]); File source = new File(args[1]);
@ -223,13 +229,6 @@ public final class LogarCLI
Logar.sort(source); Logar.sort(source);
} }
else if (isMatching(args, "testarchive", "\\s*\\S+\\s*", "\\s*\\S+\\s*"))
{
File source = new File(args[1]);
File target = new File(args[2]);
Logar.archive(source, target, DryOption.ON);
}
else if (isMatching(args, "testconcate", "\\s*\\S+\\s*")) else if (isMatching(args, "testconcate", "\\s*\\S+\\s*"))
{ {
File source = new File(args[1]); File source = new File(args[1]);