Changeset 66

Show
Ignore:
Timestamp:
23.04.2002 15:29:52 (7 years ago)
Author:
tibob
Message:

UTC time (bis)

Location:
trunk
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • trunk/HISTORY

    r65 r66  
    1 Version 0.11.5 - 11 November 2001 
    2 --------------------------------- 
     1Version 0.11.5 - ??? 
     2-------------------- 
    33- a forked child exits with _exit(), so we can let pcap library set 
    44  and unset promisc mode for us under linux. Thanks to Igor Podlesny 
  • trunk/ipfm.conf.sample

    r48 r66  
    11# Global variables 
     2 
     3# IPFM can monitor only one device. 
    24#DEVICE eth0 
    35 
    4 # local variables 
     6# UTC to output times in UTC, not local time 
     7#UTC 
     8 
     9# analyses configurations 
     10 
    511##### FIRST LOGGING CONFIGURATION ##### 
     12 
    613#log subnet 10.10.10.0 when not in relation with subnet 10.1O.0.0 
    714LOG 10.10.10.0/255.255.255.0 NOT WITH 10.10.0.0/255.255.0.0 
    815#do not log 10.10.10.10 when in relation with 10.10.10.20 
    916LOG NONE 10.10.10.10 WITH 10.10.10.20 
    10 FILENAME "/var/log/ipfm/ipfm-%d.%m-%H.%M.%S" 
     17 
     18FILENAME "/var/log/ipfm/%Y_%d_%m/%H_%M" 
     19 
    1120# log every hour at exactly 0:05, 1:05, 2:05 etc. 
    1221DUMP EVERY 1 hour AFTER 5 minutes 
    13 # clear statistics each day (at 0:05) 
     22# clear statistics each day (at 00:05 UTC) 
    1423CLEAR EVERY 24 hour 
    1524SORT IN 
     
    3241 
    3342 
    34 FILENAME "/var/log/ipfm/ipfm2-%d.%m/%H.%M.%S" 
     43FILENAME "/var/log/ipfm/subnet/%Y_%d_%m_%H" 
    3544# Log every hour 
    3645DUMP EVERY 1 hour 
    37 # Clear statistics every day at 2:00am 
     46# Clear statistics every day at 2:00am UTC 
    3847CLEAR EVERY 1 day AFTER 2 hours 
    3948SORT TOTAL 
  • trunk/source/config.h.in

    r63 r66  
    1818#define DEFAULT_OPTIONS_PROMISC       1 
    1919#define DEFAULT_OPTIONS_APPEND        0 
     20#define DEFAULT_OPTIONS_TIMEZONE      local 
    2021 
    2122/* But leave these defines untouched */ 
     
    6566#undef __OS_OSF1__ 
    6667 
     68/* Timezone : Local Time, Coordinated Universal Time */ 
     69typedef enum {UTC, local} ipfm_timezone; 
     70 
    6771#endif 
    6872 
  • trunk/source/config.l

    r63 r66  
    7474[Ff][Rr][Oo][Mm]                 return FROM; 
    7575[Ff][Ii][Ll][Ee][Nn][Aa][Mm][Ee] return FILENAME; 
     76[Ll][Oo][Cc][Aa][Ll][Tt][Ii][Mm][Ee]  return LOCALTIME; 
    7677[Ll][Oo][Gg]                     return LOG; 
    7778[Nn][Ee][Ww][Ll][Oo][Gg]         return NEWLOG;  
     
    8283[Ss][Oo][Rr][Tt]                 return SORT; 
    8384[Tt][Oo]                         return TO; 
     85[Uu][Tt][Cc]                     return UNIVERSALTIME; 
    8486[Ww][Ii][Tt][Hh]                 return WITH; 
    8587 
  • trunk/source/config.y

    r63 r66  
    6464extern int yydebug; 
    6565 
     66ipfm_timezone tz; 
     67 
    6668#ifdef YYDEBUG 
    6769 yydebug = 1; 
     
    9193%token FILENAME 
    9294%token FROM 
     95%token LOCALTIME 
    9396%token LOG 
    9497%token NEVER 
     
    100103%token SORT 
    101104%token TO 
     105%token UNIVERSALTIME 
    102106%token WITH 
    103107 
     
    247251          checkdump = 2; 
    248252          pAllLogs = pNewLog; 
     253        } 
     254      | LOCALTIME EOL { 
     255          tz = local; 
     256        } 
     257      | UNIVERSALTIME EOL { 
     258          tz = UTC; 
    249259        } 
    250260      | error EOL { 
  • trunk/source/data.c

    r65 r66  
    5252extern struct AllLogsType *pAllLogs; 
    5353extern char *device; 
     54extern ipfm_timezone tz; 
    5455 
    5556void data_add(struct AllLogsType *pLog, u_int32_t ip, int in, int out) { 
     
    116117    char DataToFile[MAX_DATA_SIZE]; 
    117118    char *stringTime; 
     119    char *timezonestring; 
     120 
     121    if (tz == local) { 
     122      timezonestring = "local time"; 
     123    } else { 
     124      timezonestring = "UTC"; 
     125    } 
    118126 
    119127    DataSort(pLog); 
     
    151159 
    152160    stringTime = timefile("%Y/%m/%d %H:%M:%S", pLog->NextDump); 
    153     fprintf(logfile, "# IPFMv%s %s UTC -- dump every %ldd%02ld:%02ld:%02ld -- listening on %s\n", 
    154             VERSION, stringTime, 
     161 
     162    fprintf(logfile, "# IPFMv%s %s (%s) -- dump every %ldd%02ld:%02ld:%02ld -- listening on %s\n", 
     163            VERSION, stringTime, timezonestring, 
    155164            pLog->DumpInterval / (60*60*24), 
    156165            (pLog->DumpInterval / (60*60)) % 24, 
  • trunk/source/init.c

    r63 r66  
    5555extern int SigDump; 
    5656extern int checkdump; 
     57extern ipfm_timezone tz; 
    5758extern struct AllLogsType *pAllLogs; 
    5859int run_as_daemon = 1; 
     
    166167  pAllLogs = pNewLog; 
    167168 
     169  tz = DEFAULT_OPTIONS_TIMEZONE; 
    168170  checkdump = 2; 
    169171 
  • trunk/source/utils.c

    r65 r66  
    4040#include "missing/missing.h" 
    4141 
     42extern ipfm_timezone tz; 
     43 
    4244char *timefile(char *filemask, time_t when) { 
    4345  char s_temp[FILENAME_MAX]; 
     
    4547  struct tm *p_time; 
    4648   
    47   /* 20020421, tibob : IPFM uses UTC only */ 
    48   p_time = gmtime(&when); 
     49  if (tz == local) { 
     50    p_time = localtime(&when); 
     51  } else { 
     52    p_time = gmtime(&when); 
     53  } 
    4954  strftime(s_temp, sizeof(s_temp), filemask, p_time); 
    5055