1

I want to be able to filter for specific entries in the Syslog on my Linux computer. For instance, I'd like to be able to filter for user authentication failure or success, or for access to sensitive information, etc.

I believe I have to start by getting a list of all of the possible Syslog messages, like this, but for Syslog messages.

  • Why? This appears to be a X->Y problem, where you've not actually told us what you're trying to do. As such, you'll never get an appropriate answer. – djsmiley2k Sep 3 '18 at 14:03
  • I want to filter my syslog messages to get only those I am interested in. I would like for example to get the syslog messages saying that a user authentication has failed or succeed. – M.Brbr Sep 3 '18 at 14:30
  • 1
    Grep is your friend in this case. You could filter for only Auth level messages, however the syslog levels rely on applications logging to the right levels, or you having filters to make sure everything is in the right levels. I'd personally just call the syslog and then grep for what I need: grep /var/log/messages 'logged' – djsmiley2k Sep 3 '18 at 14:53
  • Keep in mind that some of the events you're requesting are a bit fuzzy. Authentication failures are logged by PAM – except when they don't use PAM (password logins do, but SSH publickey logins don't). Administrator actions are so many and varied that it's practically impossible to have a single "event" for all of them. – grawity Sep 6 '18 at 11:40
2

Such a list is impossible, as unlike Windows events (which have a static list of IDs, a specific template for each ID, and only fill in parameters) syslog messages are simply free-form text.

To enumerate possible messages even for a single program would require searching its source code for syslog() calls, which might be made indirectly through custom functions, through various libraries (e.g. log4net) or not use syslog at all (e.g. various programs use systemd-journal functions). So that requires specific knowledge about each program's source code, and cannot be easily automated at the scale of an entire Linux distribution – which it would have to be, as new versions may have different messages.

(The systemd journal does have optional message IDs and 'catalog' files containing descriptions and translations. It's still opt-in and the usage is rare.)


Really even the Windows event message lists only cover the standard OS components and perhaps things like MS Office. They cannot possibly cover all messages that third-party software might log, which might install its own catalogs and event IDs, or even submit freeform messages.

  • However, can I get such a list for "basic" events such as authentication or a log into a new session ? – M.Brbr Sep 6 '18 at 8:48
  • @M.Brbr: You might want to look into Logwatch, which is a popular syslog analyzer and comes with predefined patterns for such events. – grawity Sep 6 '18 at 11:34
  • The Windows event viewer allows applications to add to the dictionary and templates so that applications CAN write their logs into the same list and they can be filtered and queried like standard events. There are error messages you'll see from time to time in the Event Viewer when an application reported an error but the OS doesn't have any context or reference on the error, basically, the application install didn't give the OS the information necessary to interpret the application errors, but the application still tries reporting errors to the OS. – music2myear Sep 6 '18 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.