Flat-file accounting is typically used for recording
accounting statistics on logical interfaces for Extensible Subscriber
Services Manager (ESSM) business subscribers. However, starting in Junos OS Release 16.1R4, you
can also use flat-file accounting to collect and archive various accounting
statistics for your Layer 2 wholesale environment. You do this by creating a flat-file profile and applying it to a
core-facing physical interface.
You can also configure a flat-file profile to monitor and report
Layer 2 multicast statistics; you assign this profile to the logical
interface configured on the core-facing physical interface. This approach
enables you to have separate accounting files that overlap in content
only in the non-statistical, general parameters. The Layer 2 multicast
statistics are available only when the encapsulation on the logical
interface is ethernet-vpls
.
You can configure multiple accounting profiles with different
combinations of fields for specific accounting requirements, and then
assign the profiles as needed to provisioned interfaces to satisfy
the accounting requirements for each interface depending on how the
interface is used.
A given flat-file profile can be assigned to both use cases;
for example, by specifying all-fields
for a global or group
level. In this case, the fields you configure appear in the accounting
record only if they make sense in the context.
Best Practice: We recommend you use separate flat-file profiles
for Layer 2 wholesale core-facing physical interfaces and ESSM business
subscriber logical interfaces.
Some statistics and general parameter fields are available either
only for logical interfaces or only for physical interfaces. The accounting-type
, line-id
, nas-port-id
, and vlan-id
general parameters are not available for
core-facing physical interfaces. Because the core-facing physical
interfaces carry Layer 2 cross-connected sessions, no useful IPv6
statistics are available. Accordingly, do not configure the input-v6-bytes
, input-v6-packets
, output-v6-bytes
, or output-v6-packets
overall packet fields.
To configure flat-file accounting for a Layer 2 wholesale
network:
- Create a flat-file profile.
[edit accounting-options]
user@host# edit flat-file-profile profile-name
- (Optional) Configure the name of the XML schema for the
accounting flat file.
[edit accounting-options flat-file-profile profile-name]
user@host# set schema-version schema-name
- Specify the filename for the accounting file.
[edit accounting-options flat-file-profile profile-name]
user@host# set file accounting-filename
- Specify the general, nonstatistical parameters for the
accounting file that are displayed as part of the accounting record
header.
[edit accounting-options flat-file-profile profile-name fields]
user@host# set general-param option
Best Practice: We recommend that you include the general parameter all-fields
option for both core-facing physical interfaces
and, when you are collecting Layer 2 multicast statistics, on the
logical interface that represents the physical interface.
- Specify the accounting statistics that are collected and
recorded in the accounting file for the core-facing physical interface.
[edit accounting-options flat-file-profile profile-name fields]
user@host# set egress-stats option
user@host# set ingress-stats option
user@host# set overall-packet option
Best Practice: We recommend that you include the following statistics
fields in flat-file profiles for core-facing physical interfaces:
Egress statistics fields: all-fields
Ingress statistics fields: all-fields
Overall packet fields: input-bytes
, input-discards
, input-errors
, input-packets
, output-bytes
, output-errors
, output-packets
- (Optional) For Layer 2 multicast statistics, specify the
accounting statistics that are collected and recorded in the accounting
file for the logical interface representing the core-facing physical
interface.
[edit accounting-options flat-file-profile profile-name fields]
user@host# set l2-stats option
Best Practice: We recommend that you include the following statistics
fields in flat-file profiles for logical interfaces on the core-facing
physical interfaces:
- (Optional) Specify the format of the accounting file.
[edit accounting-options flat-file-profile profile-name]
user@host# set format (csv | ipdr)
- (Optional) Specify the interval at which the Packet Forwarding
Engine associated with the interface is polled for the statistics
specified in the profile.
[edit accounting-options flat-file-profile profile-name]
user@host# set interval minutes
Note: When you do not configure this option, the polling interval
is 15 minutes.
- Configure the maximum size of the accounting file.
[edit accounting-options file filename]
user@host# set size bytes
- Configure one or more archive sites for the files.
[edit accounting-options file filename]
user@host# set archive-sites site-name
The site-name
is any valid FTP
or Secure FTP URL. When the file is archived, the router attempts
to transfer the file to the archive site. If you have specified more
than one site, it tries the first site in the list. If that fails,
it tries each site in turn until a transfer succeeds The log file
is stored at the archive site with a filename of the format router-name_log-filename_timestamp
. The last site
in a list is often a local directory, in case no remote site is reachable.
- (Optional) Configure the start time for transferring files.
[edit accounting-options file filename]
user@host# set start-time YYYY-MM-DD.hh:mm
- (Optional) Configure how frequently the file is transferred.
[edit accounting-options file filename]
user@host# set transfer-interval minutes
Note: When you do not configure this option, the file is transferred
every 30 minutes.
- (Optional) Configure the maximum number of files (3 through
1000) to save.
[edit accounting-options file filename]
user@host# set files number
Note: When you do not configure this option, a maximum of 10
files are saved.
- (Optional) Configure the router to save a backup copy
of the accounting file to the /var/log/pfedBackup directory if the normal transfer of the files to the archive sites
fails.
[edit accounting-options file filename]
user@host# set backup-on-failure
Note: When you do not configure this option, the file is saved
on failure into the local directory specified as the last site in
the list of archive sites.
- (Optional) Configure the accounting file to be compressed
during transfer to an archive site.
[edit accounting-options file filename]
user@host# set compress
- (Optional) Configure the router’s new backup Routing
Engine to send its accounting file to the /var/log/pfedBackup directory on the new primary Routing Engine when a change in primary
role occurs.
[edit accounting-options file filename]
user@host# set push-backup-to-master
- (Optional) Configure the number of days after which accounting
files are deleted from the local backup directory.
[edit accounting-options]
user@host# set cleanup-interval days
Note: Files are retained for 1 day if you do not configure this
option.
- Assign the profile to the relevant interface.
For the core-facing physical interface:
[edit interfaces physical-interface-name]
user@host# set accounting-profileflat-file-profile-name
For the logical interface representing the core-facing physical
interface:
[edit interfaces physical-interface-name unit logical-unit-number]
user@host# set accounting-profileflat-file-profile-name
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.
16.1R4
However, starting in Junos OS Release 16.1R4, you
can also use flat-file accounting to collect and archive various accounting
statistics for your Layer 2 wholesale environment.