Reputation: 602
msg="Overlapping blocks found during reloadBlocks" detail="[mint: 1615752000000, maxt: 1615759180001, range: 1h59m40s, blocks: 2]: <ulid: 01F4N20ECMTEAK47DT3A6CSVPW, mint: 1615752000000, maxt: 1615759180001, range: 1h59m40s>, <ulid: 01F42H5XRTFJZP0CGAQP2YHDB7, mint: 1615752000000, maxt: 1615759180001, range: 1h59m40s>\n[mint: 1615759200000, maxt: 1615762780001, range: 59m40s, blocks: 2]: <ulid: 01F4N20WGMS1RX8ZV2A3PZQQQK, mint: 1615759200000, maxt: 1615762780001, range: 59m40s>, <ulid: 01F42H6EE2T7S688XAF14K5WKF, mint: 1615759200000, maxt: 1615766380001, range: 1h59m40s>\n[mint: 1615723200000, maxt: 1615730380001, range: 1h59m40s, blocks: 2]: <ulid: 01F42H3ZXFFMRC5108FXKZPN2X, mint: 1615723200000, maxt: 1615730380001, range: 1h59m40s>, <ulid: 01F4N1YEY1BAPF87PFFKK337DX, mint: 1615723200000, maxt: 1615730380001, range: 1h59m40s>\n[mint: 1615730400000, maxt: 1615737580001, range: 1h59m40s, blocks: 2]: <ulid: 01F4N1YXR9NQ6VXNC42V5XPVGX, mint: 1615730400000, maxt: 1615737580001, range: 1h59m40s>, <ulid: 01F42H4GR1BWBC2TEGHECV9WZ7, mint: 1615730400000, maxt: 1615737580001, range: 1h59m40s>\n[mint: 1615744800000, maxt: 1615751980001, range: 1h59m40s, blocks: 2]: <ulid: 01F4N1ZZAE9DSXJDCBCFTSQ1QW, mint: 1615744800000, maxt: 1615751980001, range: 1h59m40s>, <ulid: 01F42H5F8A0K6X6XAK1WSA314A, mint: 1615744800000, maxt: 1615751980001, range: 1h59m40s>"
msg="Found overlapping blocks during compaction" ulid=01F4T0FFTFMHW44712M75NTHBW
I have logs like these and would like to find all ulids. Some logs have the format ulid: <id>
, and others have ulid=<id>
. A line can have multiple ulids.
Upvotes: 0
Views: 68
Reputation: 58578
This might work for you (GNU sed):
sed -E 's/ulid: ([^,]*)/\n\1\n/;s/[^\n]*\n//;/\n/P;D' file
Surround the ulid by newlines.
Throw away the front non ulid string.
Print the ulid (remember it must be delimited by a newline)
Delete the printed ulid and repeat.
Upvotes: 1
Reputation: 247250
With GNU grep:
grep -oP 'ulid(=|: )\K[A-Z0-9]+' file
The ulids in this sample are:
01F4N20ECMTEAK47DT3A6CSVPW
01F42H5XRTFJZP0CGAQP2YHDB7
01F4N20WGMS1RX8ZV2A3PZQQQK
01F42H6EE2T7S688XAF14K5WKF
01F42H3ZXFFMRC5108FXKZPN2X
01F4N1YEY1BAPF87PFFKK337DX
01F4N1YXR9NQ6VXNC42V5XPVGX
01F42H4GR1BWBC2TEGHECV9WZ7
01F4N1ZZAE9DSXJDCBCFTSQ1QW
01F42H5F8A0K6X6XAK1WSA314A
01F4T0FFTFMHW44712M75NTHBW
Upvotes: 1