LsVarLog - command ls -laR /var/log

This parser reads the /var/log directory listings and uses the FileListing parser class to provide a common access to them.

Examples

>>> varlog = shared[LsVarLog]
>>> '/var/log' in varlog
True
>>> varlog.dir_contains('/var/log', 'messages')
True
>>> messages = varlog.dir_entry('/var/log', 'messages')
>>> messages['type']
'-'
>>> messages['perms']
'rw-------'
class insights.parsers.ls_var_log.LsVarLog(context, extra_bad_lines=None)[source]

Bases: insights.core.CommandParser, insights.core.FileListing

A parser for accessing “ls -laR /var/log”.

get_filepermissions(dir_name_where_to_search, dir_or_file_name_to_get)[source]

Returns a FilePermissions object, if found, for the specified dir or file name in the specified directory. The directory must be specified by the full path without trailing slash. The dir or file name to get must be specified by the name only (without path).

This is provided for several parsers which rely on this functionality, and may be deprecated and removed in the future.

Parameters
  • dir_name_where_to_search (string) -- Full path without trailing slash where to search.

  • dir_or_file_name_to_getl (string) -- Name of the dir or file to get FilePermissions for.

Returns

If found or None if not found.

Return type

FilePermissions