basic/journal-importer: escape & ellipsize bad data in log entries

We shouldn't just log arbitrary stuff, in particular newlines and control chars
Now:
Unknown dunder line __CURSORFACILITY=6\nSYSLOG_IDENTIFIER=/USR/SBIN/CRON\nMES…, ignoring.
Unknown dunder line __REALTIME_TIME[TAMP=1404101101501874\n__MONOTONIC_TIMEST…, ignoring.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2018-05-17 11:09:07 +02:00
parent 8409f68858
commit cca24fc3e6
2 changed files with 11 additions and 3 deletions

View File

@@ -159,6 +159,9 @@ char *ellipsize_mem(const char *s, size_t old_length_bytes, size_t new_length_co
char *ellipsize(const char *s, size_t length, unsigned percent);
char *cellescape(char *buf, size_t len, const char *s);
/* This limit is arbitrary, enough to give some idea what the string contains */
#define CELLESCAPE_DEFAULT_LENGTH 64
bool nulstr_contains(const char *nulstr, const char *needle);
char* strshorten(char *s, size_t l);