Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleInvocation of Log Anonymizer Script
Usage: log-anonymizer.sh [Options]

  Options:
    -l | --log-file=<log-file>       | optional: location of a log file that should be anonymized; files, directories and wildcards can be specified
    -o | --output-dir=<directory>    | optional: output directory of anonymized log files
    -r | --rules-file=<rules-file>   | optional: the path to a file holding rules for anonymization
    -e | --export-rules=<rules-file> | optional: the path to a file to which built-in rules are exported

...

  • Options
    • -l | --log-file=<log-file>: Specifies the location of a log file to be anonymized.
      • This option can be specified repeatedly for a number of files. Wildcards can be specified and directories can be specified should all included files be anonymized.
      • Plain text log files as available with the .log file extension are considered and compressed log files available with the .gz file extension, see the JS7 - Log Rotation article.
      • Anonymized log file names are prefixed with the string: anonymized- 
      • By default anonymized log files are stored to the directory in which original log files are found.
    • -o | --output-dir=<directory>: Optionally specifies the output directory to which anonymized log files are stored. If this argument is omitted then anonymized log files are stored to their original directory.
    • -r | --rules-file=<rules-file>: Optionally specifies the location of a file in YAML format that holds the expressions that should be applied for anonymization.
    • -e | --export-rules=<rules-file>: Optionally specifies the location of a file to which default expressions for anonymization are exported.

...

Code Block
titleExample for Invocation of Log Anonymizer Script
log-anonymizer.sh --log-file=/var/sos-berlin.com/js7/controller/var/logs/controller.log

Explanation:

  • Creates an anonymized version of the log file in the same directory with the name: anonymized-controller.log


Code Block
titleExample for Invocation of Log Anonymizer Script for a number of Log Files
log-anonymizer.sh --log-file=/var/sos-berlin.com/js7/joc/logs/joc.log  \
                  --log-file=/var/sos-berlin.com/js7/joc/logs/joc-debug.log \
                  --output-dir=/tmp/logs

Explanation:

  • Creates anonymized versions of the indicated log files in the given directory:
    • /tmp/logs/anonymized-joc.log
    • /tmp/logs/anonymized-joc-debug.log


Code Block
titleExample for Invocation of Log Anonymizer Script with Wildcards for Log Files
log-anonymizer.sh --log-file=/var/sos-berlin.com/js7/joc/logs/joc*  \
                  --output-dir=/tmp/logs

Explanation:

  • Creates anonymized versions of the indicated log files from the given directory. The wildcard specifies any log files carrying a name that starts with joc to be used.
  • The wildcard includes to specify plain text log files available from the .log file extension and it includes to specify compressed log files that are available from a .gz file extension.
  • Anonymized log files are stored in the output directory.


Code Block
titleExample for Export of Rules to a File
log-anonymizer.sh --export-rules=/tmp/rules.yaml

Explanation:

  • The build-in rules are exported to a file in YAML format.
  • This file can be used to adjust rules and can be applied later on.


Code Block
titleExample for Invocation of Log Anonymizer Script with individual Rules from a File
log-anonymizer.sh --log-file=/var/sos-berlin.com/js7/agent/var_4445/logs/*.log \
                  --output-dir=/tmp/logs \
                  --rules-file=/tmp/rules.yaml

Explanation:

  • Creates anonymized versions of all log files in the indicated directory and stores them to the output directory.
  • A YAML file with individual rules is applied.