Fix cisco syslog parsing when logging timestamp is enabled #3203

Merged
merged 4 commits into from Mar 10, 2016

Projects

None yet

3 participants

@murrant
Contributor
murrant commented Mar 9, 2016

I'm not sure if the date format of this can vary much, I put two examples in the tests. One from the ticket and one from the Internet.
Also, a little more cleanup of the syslog unit tests to make them even simpler to add and use a little less memory.

Fixes: #3199

murrant added some commits Mar 9, 2016
@murrant murrant Some devices have "logging timestamp" enabled, try to remove that fro…
…m the start of the message.

Fixes #3199
bca965e
@murrant murrant Reduce memory cosumption for tests by running one assert at a time ra…
…ther than building all the data then testing.
33c4cca
@murrant murrant Another test case for the cisco syslog timestamp prefix.
d59fc01
@laf laf commented on an outdated diff Mar 9, 2016
tests/SyslogTest.php
@@ -23,6 +23,19 @@ private function createData($line, $resultDelta) {
return $data;
}
+
+ /**
+ * Test an input line with the modified fields
+ *
+ * @param string $inputline The line from the syslog daemon including the ||'s
+ * @param array $modified of the modified fields, most likely containging the keys program and msg
+ */
+ private function checkSyslog($inputline, $modified) {
@laf
laf Mar 9, 2016 Member

Would you mind just updating this function to use just 4 spaces for indentation.

@laf laf added the Core label Mar 9, 2016
@murrant murrant Fix indentation.
81a6267
@laf laf merged commit 195f820 into librenms:master Mar 10, 2016

3 checks passed

Auto-Deploy Build finished. No test results found.
Details
Scrutinizer 1 updated code elements
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@murrant murrant deleted the murrant:syslog-issue-3199 branch Mar 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment