ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
It's still about writing into separate log-files from bind, or it's about something else (like processing bind-log with a separate program)? If the former, then simply check what the content of 'peerbuff' is (my guess is: IP#port, eg 192.168.2.4#59526, 192.168.2.4#46998), then you will know how to get the IP from it (the part before the hashmark).
Very good. Now let's see the concrete specification: you have a string like '02-Aug-2012 16:02:54.189 client 192.168.2.4#53554: query: account.thequestionsnetwork.org IN A + (192.168.2.4)' and you want to cut out the IP-address. There are programming tools for that like 'cut' -- are your sure you want it in C?
can you tell me which file in bin/named is responsible for logging to the /var/log/filename
now i need to append the ip address to the log file name
if the log file is named_query.log.I need to have the file as named_query.log.192.168.132.1 and it should be created in the same place i.e. in /var/log/
in client.c they call isc_log_write so we need to see what that calls internally and see how that maps to log_write
then in isc_log_write in logconf.c, when we get peerbuf as one of the parameters, we need to call getip and log to a different file.
How can we do that any hint?
Last edited by Balvinder87; 08-09-2012 at 12:36 AM.
hey nevem its really important for me to complete this task by today.i have added a plugin in bind9 source which gets the ip address from the output string now in the final string.based on this ip i need to append it to filename( if my file name is named_querylog then the cooresponding logs of the ip will be in the file name as named_query.log.192.168.132.1
so i need to find out the behaviour of isc_log_write can you help me find out what is happening in this function?
what context it passes to log_write in the case where it logs peerbuf?
i am using bind 9.7.3 please reply its really important?
You don't have to trace and modify the existing function, just add a few line to create client-specific file-name, open it, write the log-record, then close the file. And, as it happens, you are already given code to do that. http://www.linuxquestions.org/questi...ml#post4746345
That's what you have to add after/before the calling of isc_log_write.
I guess the code that you have given is writing the logs of clients to different files
i need to pick up the ip address from peerbuf and based on that ip i need to write the log in the files as
will your code behave that way?
Last edited by Balvinder87; 08-09-2012 at 11:56 PM.