cloudflare / cloudflare/workers-sdk
Wrangler tail filters do not take immediate effect
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 186
Description
### Which Cloudflare product(s) does this pertain to?
Wrangler
### What versions & operating system are you using?
Wrangler 4.9.1, macOS Sequoia 15.3.2
### Please provide a link to a minimal reproduction
_No response_
### Describe the Bug
When running `wrangler tail` multiple times in succession, there's a lag before `--search` filters get applied. I think what might be happening based on the timestamps is that old log messages that were queued up with the old filter are printed out in the new tail session. I'd expect the two `wrangler tail` sessions to be independent.
First, I create a tail with no filter:
```
npx wrangler tail -e=cftest
⛅️ wrangler 4.9.1
------------------
Successfully created tail, expires at 2025-04-09T19:01:50Z
Connected to static-ct-cftest, waiting for logs...
Alarm @ 4/9/2025, 9:55:27 AM - Ok
(info) cftest2025h2a: Sequenced pool; tree_size=4368211, entries: 0, tiles: 0, timestamp: 1744206927643, duration: 0.35s, since_last: 1.00s
Alarm @ 4/9/2025, 9:55:27 AM - Ok
(info) cftest2025h1a: Sequenced pool; tree_size=274276, entries: 0, tiles: 0, timestamp: 1744206927848, duration: 0.40s, since_last: 1.00s
Alarm @ 4/9/2025, 9:55:28 AM - Ok
(info) cftest2025h1a: Sequenced pool; tree_size=274276, entries: 0, tiles: 0, timestamp: 1744206928848, duration: 0.37s, since_last: 1.00s
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:28 AM
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:28 AM
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:28 AM
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:28 AM
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:28 AM
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:28 AM
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:28 AM
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:28 AM
```
Then, I add the `--search` flag to filter to just a subset of log messages, but messages not matching the filter are printed out:
```
npx wrangler tail -e=cftest --search "cftest2025h2a: Sequenced"
⛅️ wrangler 4.9.1
------------------
Successfully created tail, expires at 2025-04-09T19:01:50Z
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:38 AM
Connected to static-ct-cftest, waiting for logs...
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:39 AM
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:38 AM
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:39 AM
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:38 AM
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:39 AM
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:38 AM
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:39 AM
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:39 AM
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:38 AM
POST https://static-ct.cloudflareresearch.com/logs/cftest2025h2a/ct/v1/add-chain - Ok @ 4/9/2025, 9:55:37 AM
POST https://static-ct.cloudflareresearch.com/logs/cftest2025h2a/ct/v1/add-chain - Ok @ 4/9/2025, 9:55:37 AM
POST https://static-ct.cloudflareresearch.com/logs/cftest2025h2a/ct/v1/add-chain - Ok @ 4/9/2025, 9:55:37 AM
POST https://static-ct.cloudflareresearch.com/logs/cftest2025h2a/ct/v1/add-chain - Ok @ 4/9/2025, 9:55:37 AM
Tail is currently in sampling mode due to the high volume of messages. To prevent messages from being dropped consider adding filters.
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:40 AM
(info) cftest2025h2a: Sequenced pool; tree_size=4369048, entries: 46, tiles: 2, timestamp: 1744206940643, duration: 0.51s, since_last: 1.00s
POST http://fake_url.com/add_leaf?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:38 AM
...
```
Then eventually (after ~10s) only log entries matching the new filter are printed.
```
...
POST https://static-ct.cloudflareresearch.com/logs/cftest2025h2a/ct/v1/add-chain - Ok @ 4/9/2025, 9:55:38 AM
Alarm @ 4/9/2025, 9:55:49 AM - Ok
(info) cftest2025h2a: Sequenced pool; tree_size=4369644, entries: 45, tiles: 2, timestamp: 1744206949643, duration: 0.52s, since_last: 1.00s
POST http://fake_url.com/add_batch?name=cftest2025h2a - Ok @ 4/9/2025, 9:55:59 AM
(info) cftest2025h2a: Sequenced pool; tree_size=4370457, entries: 0, tiles: 0, timestamp: 1744206959643, duration: 0.34s, since_last: 1.00s
Alarm @ 4/9/2025, 9:56:23 AM - Ok
(info) cftest2025h2a: Sequenced pool; tree_size=4372271, entries: 0, tiles: 0, timestamp: 1744206983643, duration: 0.38s, since_last: 1.00s
```
### Please provide any relevant error logs
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.