rsyslog: imjournal: Support input module
Allow us to bind the imjournal input to an output module. Thie enable us to block journal reading if the output module is failing. Note that we will only allow one input module for imjournal since we do not have multiple input sources. The memory usage can be high with multiple outputs.
Tested:
Example Config:
```
ruleset(name="remote"){
action(type="omfwd" target="IP_ADDRESS" port="PORT" protocol="tcp"
template="journal-format"
StreamDriver="ossl"
# Run driver in TLS-only mode
StreamDriverMode="0"
StreamDriverAuthMode="anon"
action.resumeRetryCount="-1"
queue.type="direct"
)
}
input(
type="imjournal"
ruleset="remote"
)
```
- Stop collector network -> Stop Journal pointer
```
SECONDS=0
expected="$(md5sum /var/log/state)"
echo "Expected state ${expected}"
while [ $SECONDS -lt 300 ];
do
new_state="$(md5sum /var/log/state)"
if [[ "${new_state}" != "${expected}" ]];
then
echo "Got state ${new_state} instead of ${expected}"
exit 1
fi
sleep 5
done
echo "Passed"
exit 0
```
```
Expected state 309593de34bc095e4245c1ba07a7520c /var/log/state
Passed
```
- Resume Journal Pointer
The state file changed after the connection resumed.
```
$ md5sum /var/log/state
d11c7e46fec4f86151df204608525d89 /var/log/state
```
The message send in when the connection was down is also sent out properly.
Upstream-Change: https://github.com/rsyslog/rsyslog/pull/5146
Google-Bug-Id: 271860571
Google-Bug-Id: 271406467
Google-Bug-Id: 283335713
Change-Id: I48b46589faeb46a6d3a0d04ac54cc25dc0bdfbdc
Signed-off-by: Willy Tu <wltu@google.com>
(cherry picked from commit 71020f1ee476859eb673f7864d1964a9e03ce7d6)
2 files changed