9
0
Fork 0

Fix file path include/exclude handling
continuous-integration/drone Build is passing Details

This commit is contained in:
Lauri Võsandi 2022-11-13 20:20:22 +02:00
parent 147b323e6b
commit 75fd1a31ad
2 changed files with 4 additions and 7 deletions

View File

@ -1,3 +0,0 @@
* Unlike Filebeat it sports embedded Prometheus metric exporter

View File

@ -439,7 +439,6 @@ async def watcher(queue, coll):
if path in log_files:
log_files[path].finished = finished
return log_files[path]
print("Adding file: %s" % path)
m = re.match("/var/log/pods/(.*)_(.*)_.*/(.*)/[0-9]+\\.log$", path)
@ -448,13 +447,14 @@ async def watcher(queue, coll):
counter_unexpected_filenames.inc()
return
namespace_name, pod_name, container_name = m.groups()
if args.namespace and args.namespace == namespace_name:
if args.namespace and args.namespace != namespace_name:
print("Skipping due to namespace mismatch:", path)
return
for prefix in args.exclude_pod_prefixes:
if pod_name.startswith(prefix):
print("Skipping due to pod prefix mismatch:", path)
return
if args.namespace and namespace_name != args.namespace:
return
print("Adding file: %s" % path)
lf = log_files[path] = LogFile(coll, queue, path, namespace_name,
pod_name, container_name, start, lookup_offset)
lf.finished = finished