Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
A server running multiple Drupal sites, all using syslog for watchdog, gets all messages in the log prefixed by "drupal:". I think it is a bug that there is no way to override this string ('cause if it is a feature then it is too late to change :-).
This simple patch allows each site to specify a different identity to the openlog() function.
Comment | File | Size | Author |
---|---|---|---|
#11 | syslog-identity-881540-11.patch | 4.34 KB | bjaspan |
#7 | d6-syslog-identity-881540-7.patch | 1.51 KB | bjaspan |
#4 | syslog-identity.patch-881540-5.patch | 1.68 KB | bjaspan |
syslog-identity.patch | 1.55 KB | bjaspan | |
Comments
Comment #1
JacobSingh CreditAttribution: JacobSingh commentedThis looks like a non-evil patch. Ideally, I would like to see this type of altering happening in an altering hook or a single function which is globally defined for this purpose. I can see cases where you want different facilities, etc depending on the content of the message, other vars, etc..
But for now, an improvement and worth adding.
Comment #2
Dries CreditAttribution: Dries commentedShould we make a recommendation as how to pick a good Syslog identity? I'm not sure people will get it based on the current form description. Thoughts?
Comment #3
jbrown CreditAttribution: jbrown commentedI think the site URL should be in there somewhere...
Comment #4
bjaspan CreditAttribution: bjaspan commentedre #3: The site URL is already in there. Here is a sample entry from my local notebook. I set the identity field to "headtest" and the base_url() is http://head.local:8888:
Aug 12 13:50:36 barry-jaspans-macbook-pro-10 headtest[23671]: http://head.local:8888|1281635436|cron|127.0.0.1|http://head.local:8888/admin/reports/status/run-cron?render=overlay|http://head.local:8888/|0||Cron run completed.
re #2: New language in patch.
Already marked RTBC and I just changed a string, to leaving it RTBC.
Comment #5
Dries CreditAttribution: Dries commentedOK, I committed to CVS HEAD. It makes sense to make it configurable (according to the specification), but people could already differentiate between sites using the URL field, not?
Comment #6
bjaspan CreditAttribution: bjaspan commentedThe problem with using the URL field is that there may be many different domains served by a single site, so it could be tricky, slow, or annoying to construct a grep regexp to match exactly the right set of log entries.
Marking fixed since the patch is committed.
Comment #7
bjaspan CreditAttribution: bjaspan commentedThe same improvement is useful for D6.
Comment #8
Dave ReidThe patch is missing an variable_del() on uninstall for this addition.
Comment #9
bjaspan CreditAttribution: bjaspan commentedYou are correct that the patch committed to D7 does not have a variable_del() for the new variable, but in fact syslog.module already had two other variables and has no .install file or uninstall hook at all. So, it's a bug, but it is not really a bug with this patch. Open a separate issue if you feel strongly. :-)
Comment #10
bjaspan CreditAttribution: bjaspan commentedActually, there is another bug in syslog.module: The syslog_format form element is inside the block testing if LOG_LOCAL0 exists, when it should not. That is also not really related to this patch, though this patch makes the existing problem "worse" by adding yet another form element incorrectly inside the block. So, fine, I'll fix both and submit a new patch.
Comment #11
bjaspan CreditAttribution: bjaspan commentedNew patch. Adds syslog.install with an uninstall hook for all variables and fix the if LOG_LOCAL0 test I mentioned in the previous comment.
Comment #12
bjaspan CreditAttribution: bjaspan commentedOoops, this is a D7 patch.
Comment #13
bjaspan CreditAttribution: bjaspan commentedComment #14
Dries CreditAttribution: Dries commentedLooks good. Committed to CVS HEAD.
Comment #15
bjaspan CreditAttribution: bjaspan commentedPutting this issue back to RTBC for D6. The patch in #7 is still valid. It does not add a variable_del() for the new variable on uninstall, because like D7, D6 syslog.module has no uninstall. It seems less important to fix this oversight for D6 than for D7. If necessary though the syslog.install file from the patch in #11 should work for D6 too.
Comment #16
Gábor HojtsyThanks, committed the install fragment from #11 and the patch from #7.