| 1 | pattern: logfmt |
| 2 | |
| 3 | inject: |
| 4 | - key: SIMPLE_INJECTION |
| 5 | value: "An unset variable looks like '${this}', while the value of KEY2 is '${KEY2}'" |
| 6 | |
| 7 | rewrite: |
| 8 | - key: INJECTED |
| 9 | value: "${KEY1} - ${KEY2}" |
| 10 | inject: yes |
| 11 | stop: no |
| 12 | |
| 13 | - key: INJECTED |
| 14 | match: '^value01' |
| 15 | value: "Key INJECTED had value '${INJECTED}' and now has this, but only on the first row of the log." |
| 16 | |
| 17 | - key: INJECTED |
| 18 | not_empty: "${KEY4}" |
| 19 | value: "KEY4 has the value '${KEY4}'; it is not empty, so INJECTED has been rewritten." |
| 20 | |
| 21 | - key: INJECTED |
| 22 | match: '^KEY4 has the value' |
| 23 | value: "This value should not appear in the logs, because the previous one matched and stopped the pipeline." |
| 24 | |
| 25 | - key: ANOTHER_INJECTION |
| 26 | value: "${KEY1} - ${KEY2} - ${INJECTED} - should not work because inject is not true amd ANOTHER_INJECTION is not in the log file." |
| 27 | |
| 28 | - key: YET_ANOTHER_INJECTION |
| 29 | value: "${KEY1} - ${KEY2} - ${INJECTED} - this should work because inject is yes" |
| 30 | inject: yes |
| 31 | |
| 32 | - key: SIMPLE_INJECTION |
| 33 | match: "KEY2 is 'value32'" |
| 34 | value: "" # empty, so SIMPLE_INJECTION should not be available on row 3 |