ifile

Description

This iRules command returns content and attributes from external files on the BIG-IP system
The filesize for a single iFile was raised to 32Mb in 12.1.0. Prior versions limited the size to 4Mb.

Syntax

ifile get <iFile Name>
ifile listall
ifile attributes <iFile Name>
ifile size <iFile Name>
ifile last_updated_by <iFile Name>
ifile last_update_time <iFile Name>
ifile revision <iFile Name>
ifile checksum <iFile Name>
array set <variable> [ifile attributes <iFile Name>]

ifile get

  • returns the contents of the file

ifile listall

  • returns a list of all iFiles available

ifile attributes

  • returns all the attributes of an iFile

ifile size

  • returns the size of an iFile

ifile last_updated_by

  • returns the user who last update the iFile on the system

ifile last_update_time

  • returns the date the iFile was last updated

ifile revision

  • returns the current revision of the iFile

ifile checksum

  • returns the checksum of the iFile

array set [ifile attributes ]

  • stores all the iFile attributes for an iFile in an array

===Examples===

when RULE_INIT {
   # Get a list of iFiles
   # Waiting 10 seconds first to ensure they are fully defined after iFile loading is complete
   after 10000 {
      set ifilelist [ifile listall]
      log local0. "List of files: $ifilelist"

      # Print the attributes for the first iFile in the list
      log local0. "Attributes for the first file [lindex $ifilelist 0]:"
      array set ifile_attributes [ifile attributes [lindex $ifilelist 0]]
      foreach {array attr} [array get ifile_attributes] {
         log local0. "Array $array Attr: $attr"
      }
      unset ifilelist ifile_attributes array attr
   }
}

when HTTP_REQUEST {
   # Retrieve the file contents, send it in an HTTP 200 response and clear the temporary variable
   set ifileContent [ifile get "/Common/iFile-index.html"]
   HTTP::respond 200 content $ifileContent
   unset ifileContent
}