Chapter 5. Writing a New Report
Prev | Part II. Using the Lire Framework | Next

## Chapter 5. Writing a New Report

Writing a new report involves writing a report specification, e.g. `/service/<superservice>/reports/top-foo-by-bar.xml`, and adding this report along with possible configuration parameters to `<service>.cfg`. E.g., to create a new report, based upon `email/from-domain.xml`: copy the file `/usr/local/etc/lire/email.cfg` to `~/.lire/etc/email.cfg`. Copy the file `/usr/local/share/lire/reports/email/top-from-domain.xml` to e.g. `~/.lire/reports/reports/email/from-domain.xml`. Edit the last file to your needs, and enable it by listing it in your `~/.lire/etc/email.cfg`.

Beware! The name of the report generally consists of alphanumerics and '-', but the name of parameters may not contain any '-' characters. It generally consists of alphanumerics and '_' characters.

## Filter Specification

For now, you'll have to refer to the example filters as found in the current report specification files. We'll give one other example here: specifying a time range.

Suppose you want to be able to report on only a specific time range. You could build a (possibly global and reused) filter like:

          <lire:filter-spec>
            <lire:and>
              <lire:ge arg1="$timestamp" arg2="$period-start"/>
              <lire:le arg1="$period-end" arg2="$timestamp"/>
            </lire:and>
          </lire:filter-spec>

When trying your new filter, you could install it in `~/.lire/filters/your-filter-name.xml`. When lr_dlf2xml looks up a filter which was mentioned in the report configuration file, it looks first in `~/.lire/filters/`, and then in `.../share/lire/filters/`.

Prev | Up | Next
DLF Analyser API | Home | Part III. Developer's Reference