Documentation ¶
Overview ¶
Package files handles searching
Package files handles searching
Index ¶
- Variables
- func ExtractTimeIfPresent(inputText string) metav1.Time
- func FindFileInClusterRoot(clusterRoot string, filename string) string
- func FindFileInNamespace(clusterRoot string, namespace string, filename string) string
- func FindNamespaces(log *zap.SugaredLogger, clusterRoot string) (namespaces []string, err error)
- func FindPodLogFileName(clusterRoot string, pod corev1.Pod) string
- func GetMatchingDirectories(log *zap.SugaredLogger, rootDirectory string, fileMatchRe *regexp.Regexp) (fileMatches []string, err error)
- func GetMatchingFiles(log *zap.SugaredLogger, rootDirectory string, fileMatchRe *regexp.Regexp) (fileMatches []string, err error)
- func IsInTimeRange(timeToCheck metav1.Time, timeRange *TimeRange) bool
- type TextMatch
- func FindFilesAndSearch(log *zap.SugaredLogger, rootDirectory string, fileMatchRe *regexp.Regexp, ...) (matches []TextMatch, err error)
- func SearchFile(log *zap.SugaredLogger, fileName string, searchMatchRe *regexp.Regexp, ...) (matches []TextMatch, err error)
- func SearchFiles(log *zap.SugaredLogger, rootDirectory string, files []string, ...) (matches []TextMatch, err error)
- func SearchMatches(log *zap.SugaredLogger, matchesToSearch []TextMatch, ...) (matches []TextMatch, err error)
- type TimeRange
Constants ¶
This section is empty.
Variables ¶
var ZeroTime = metav1.NewTime(time.Time{})
Functions ¶
func ExtractTimeIfPresent ¶ added in v0.14.0
ExtractTimeIfPresent determines if the text matches a known pattern which has a timestamp in it (such as known log formats) and will extract the timestamp into a wrappered metav1.Time. If there is no timestamp found it will return a zero time value
func FindFileInClusterRoot ¶
FindFileInClusterRoot will find filename in the cluster root
func FindFileInNamespace ¶
FindFileNameInNamespace will find filename in the namespace
func FindNamespaces ¶
func FindNamespaces(log *zap.SugaredLogger, clusterRoot string) (namespaces []string, err error)
FindNamespaces relies on the directory structure of the cluster-dump/namespaces to determine the namespaces that were found in the dump. It will return the namespace only here and not the entire path.
func FindPodLogFileName ¶
FindPodLogFileName will find the name of the log file given a pod
func GetMatchingDirectories ¶
func GetMatchingDirectories(log *zap.SugaredLogger, rootDirectory string, fileMatchRe *regexp.Regexp) (fileMatches []string, err error)
GetMatchingDirectories returns the filenames for directories that match a regular expression.
func GetMatchingFiles ¶
func GetMatchingFiles(log *zap.SugaredLogger, rootDirectory string, fileMatchRe *regexp.Regexp) (fileMatches []string, err error)
GetMatchingFiles returns the filenames for files that match a regular expression.
func IsInTimeRange ¶ added in v0.14.0
IsInTimeRange will check if a specified time is within the specified range It will return true if:
- there is no time range specified
- a time range is specified and the time specified is in that range (see TimeRange type)
Otherwise it will return false:
- if the time is zero and there is a range specified, it can't determine it
- if the time is not within the range specified
Types ¶
type TextMatch ¶
TextMatch supplies information about the matched text
func FindFilesAndSearch ¶
func FindFilesAndSearch(log *zap.SugaredLogger, rootDirectory string, fileMatchRe *regexp.Regexp, searchMatchRe *regexp.Regexp, timeRange *TimeRange) (matches []TextMatch, err error)
FindFilesAndSearch will search across files that match a specified expression
func SearchFile ¶
func SearchFile(log *zap.SugaredLogger, fileName string, searchMatchRe *regexp.Regexp, timeRange *TimeRange) (matches []TextMatch, err error)
SearchFile search a file
func SearchFiles ¶
func SearchFiles(log *zap.SugaredLogger, rootDirectory string, files []string, searchMatchRe *regexp.Regexp, timeRange *TimeRange) (matches []TextMatch, err error)
SearchFiles will search the list of files that are already known for text that matches
func SearchMatches ¶
func SearchMatches(log *zap.SugaredLogger, matchesToSearch []TextMatch, searchMatchRe *regexp.Regexp) (matches []TextMatch, err error)
SearchMatches will search the list of TextMatch using a search expression and will return all that match
type TimeRange ¶ added in v0.14.0
TimeRange is used when searching requires time bounded matches Handling of a TimeRange:
if not specified, match is included if StartTime is supplied (not zero) matches at/after that time are included if EndTime is supplied (not zero) matches at/before that time are included