When you run a business system on AS/400, logs accumulate alongside the work. This is the story of a log-file cleanup tool I built. What needed tidying up wasn’t the programs themselves, but the records they kept producing.

Related: I Added Logging. Then the Menu Stopped.

“Logs” sounds like one category. In the system I worked with, though, there were dozens of log files, each with its own retention period.

Some were kept for two years. Others for three months. Some had no expiry.

I couldn’t simply lump them together and delete anything that looked old. They shared the name “log,” but they were being kept for different reasons.

I considered how many records were being generated and how important it was to trace the processing later. Those considerations informed the retention periods.

So this wasn’t just a question of dates. First came the question of why a particular record needed to be kept.

A friendly gray-haired older man in a green shirt sorts three groups of record books with differently colored bookmark tabs on a desk.
AI illustration: record books symbolize different retention needs. This is not a portrait or a reproduction of an actual workplace, screen, or processing result.

With a handful of files, manual cleanup might be manageable. With dozens, keeping up with all those different retention periods becomes a job in itself.

And it wasn’t a one-off job. As business processing continued, more records appeared. The logs weren’t about to slow down just because I disliked repetitive chores. (Laughs.)

So I built a tool to automate the cleanup.

It worked with a log-management master in which the target logs were registered. Once registered, their cleanup was fully automated.

That didn’t mean it magically discovered every new log and worked everything out for itself. Registering the targets in the master was still a human task.

The distinction I want to draw is between deciding what to keep, and for how long, and repeatedly carrying out the cleanup according to those decisions.

The first calls for an understanding of the business that uses those records. The second needn’t remain a permanent manual chore.

The point wasn’t to eliminate the thought that goes into retention periods. It was to avoid having to carry out those decisions by hand, over and over.

Automation might bring to mind deleting things faster. But the important point here is that the logs weren’t all treated alike.

Two years, three months, no expiry: records kept for different reasons, handled by the same cleanup tool.

Delete everything because it’s a nuisance? That sounds like a fine way to create an even bigger nuisance later. (Laughs.)

Think through the reasons for keeping records. Hand the repetitive chores to a tool. That was the direction my dislike of tedious work took.

To be continued tomorrow 😊

Based on the author’s recollections of his past operation and homemade tool. The retention periods are examples from that experience, not general recommendations.

WRITTEN BYYoshio Taki

IBM i / AS/400 System Engineer