CodingNeed a Script

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  Ken (SHIELDSIT)  
 To:  ALL
41587.1 
Is there a way to have dnsmasq output dns queries to a mysql database?  I've searched and don't think there is a way to have it do it.  So if not, is there a way to write a script to copy the contents of the log file it's using to a database and then empty the file?
------------------------------------------------------------------------
If you don't like donut, then leave it alone. Nobody force you to eat it.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Ken (SHIELDSIT)     
41587.2 In reply to 41587.1 
Depending on the format of the log file I imagine a load of cuts/grep/seds would give you what you want for a command line mysql query.
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  ANT_THOMAS     
41587.3 In reply to 41587.2 
I think the only records I'd want from the log file are designated like this: [query]  so it shouldn't be terribly hard to do that right?  How would I flush that file afterward though? I think there is probably a built in command that does like like it rotates the log files.
------------------------------------------------------------------------
If you don't like donut, then leave it alone. Nobody force you to eat it.
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  ANT_THOMAS     
41587.4 In reply to 41587.2 
Got that grep portion working, thanks for reminding me about it!  It's something I should use daily but just haven't taken the time to really learn yet.
------------------------------------------------------------------------
If you don't like donut, then leave it alone. Nobody force you to eat it.
0/0
 Reply   Quote More 

 From:  ANT_THOMAS  
 To:  Ken (SHIELDSIT)     
41587.5 In reply to 41587.3 
You could delete and recreate the file at the end of the script.

Or copy the contents, empty the file, then do the mysql stuff after to make sure no extra stuff is added whilst it's all going on.
0/0
 Reply   Quote More 

 From:  Ken (SHIELDSIT)  
 To:  ANT_THOMAS     
41587.6 In reply to 41587.5 
I'll give it a shot and let you know how I've fucked things up!
------------------------------------------------------------------------
If you don't like donut, then leave it alone. Nobody force you to eat it.
0/0
 Reply   Quote More 

Reply to All    
 

1–6

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats