package stats; import java.io.*; public class Main { public static void main(String[] args) { // TODO code application logic here int tardownload = 0; int isodownload = 0; int html = 0; int rss = 0; try { String read = ""; FileReader fr = new FileReader("/var/log/httpd/access_log"); BufferedReader br = new BufferedReader(fr); while ((read = br.readLine()) != null) { if (read.contains("tar")) { tardownload++; } if (read.contains("iso")) { isodownload++; } if (read.contains("?page_id=210")) { html++; } if (read.contains("rss")) { rss++; } } } catch (Exception ads) { } System.out.print("\n\nMephisto Backup Downloads= " + tardownload); System.out.print("\n\nISO Downloads= " + isodownload); System.out.print("\n\nMephisto Website Access= " + html); System.out.print("\n\nRSS feeds= " + rss + "\n\n\n"); try { FileWriter fw = new FileWriter("/var/www/html/stats"); BufferedWriter bfw = new BufferedWriter(fw); bfw.write("Mephisto Backup Downloads= " + tardownload); bfw.write("\nISO Downloads= " + isodownload); bfw.write("\nMephisto Website Access= " + html); bfw.write("\nRSS feeds= " + rss); bfw.close(); } catch (Exception adss) { } } }