⚙️ Automate File Archiving
GermainUX can archive files automatically on a configured schedule. For example, an Executor component can compress log files older than a specified number of days, move the archives to another location, and remove the original files after successful archival.
Executor components can run commands locally or through a remote GermainUX Engine. Their output can also be processed by a Drools rule when additional analysis, validation, or data extraction is required.
🔧 Configuration
1️⃣ Step 1: Create a Local Executor Component
Create a component of type Local Executor and configure the archive command.
The following example:
|
Step |
|---|
|
Searches the source directory. |
|
Selects files matching the configured filename pattern. |
|
Selects files older than the retention period. |
|
Compresses each file as a |
|
Moves the archive to the target directory. |
|
Removes the original file only after the archive has been created and moved successfully.
|
cd "${SourceLocation}" &&
find . \
-maxdepth 1 \
-type f \
-mtime +"${RetentionDays}" \
-name "${FilePattern}" \
-exec sh -c '
target="$1"
shift
for file do
archive="${file}.tar.gz"
tar -czf "$archive" -- "$file" &&
mv -- "$archive" "$target/" &&
rm -- "$file"
done
' sh "${TargetLocation}" {} +
📌 Deployment References
Configure the following values as references when deploying the component:
|
Reference |
Description |
|---|---|
|
SourceLocation |
Directory containing the files to archive. |
|
RetentionDays |
Minimum file age, in days, before a file is archived. |
|
FilePattern |
Shell filename pattern used to select files. |
|
TargetLocation |
Directory to which completed archives are moved. |
FilePattern uses shell wildcard matching rather than a regular expression.
🔖 Example Values
SourceLocation : /siebel/Siebel/ai/applicationcontainer_external/logs
RetentionDays : 14
FilePattern : *.[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9].log
TargetLocation : /siebel/bfs/AILogsBKP/AINode4
This example archives matching log files more than 14 days old.
2️⃣ Step 2: Deploy the Component
Deploy the Local Executor component to the required GermainUX Engine:
|
Action |
|---|
|
Select the target Monitoring Node and Engine. |
|
Configure the deployment references. |
|
Set the execution interval. |
|
Deploy the component. |
|
Run it manually once to validate the configuration. |
|
Confirm that the archives were created and moved successfully. |
|
Enable the recurring schedule.
|
🛡️ Safety and Validation
This automation deletes source files after successful archival. Before enabling the schedule:
|
Check |
|---|
|
Confirm that |
|
Confirm that the target directory exists and is writable. |
|
Test the filename pattern with |
|
Use a nonproduction directory for the first test. |
|
Confirm that generated archives can be opened. |
|
Verify available disk space in both locations. |
|
Ensure that no application still requires access to the selected files. |
|
Run the Engine under an account with only the permissions required for this task. |
To preview the files that would be selected without modifying them, run:
cd "${SourceLocation}" &&
find . \
-maxdepth 1 \
-type f \
-mtime +"${RetentionDays}" \
-name "${FilePattern}" \
-print
Component: Engine
Feature Availability: 8.6.0 or later