I have a kernel module that uses printk() for debugging. printk() logs to /var/log/messages. /var/log/messages contains information of other modules too. I am trying to implement dynamic tracing for my module. My plan is to use ioctl calls to set different logging/tracing level and then, log the information from the module to a different path (my_module.log).
I am not getting information on how to write logs from kernel space (inside kernel module) to a specific file? I have checked for rsyslog but couldn't find any information if this can be used inside a kernel module.
I see a similar question, but it is not helping. Linux kernel : logging to a specific file
Could you suggest any leads?