8
0
Fork 0

Fix file path include/exclude handling

master
Lauri Võsandi 3 months ago
parent 147b323e6b
commit 75fd1a31ad
  1. 3
      README.md
  2. 8
      log_shipper.py

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

@ -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

Loading…
Cancel
Save