timed tail for logfiles. Display loglines given a minimum date and/or a maximum date.
c
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef _ttail_h__
  2. #define _ttail_h__
  3. #include <ctype.h>
  4. #include <errno.h>
  5. #include <getopt.h>
  6. #include <regex.h>
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <string.h>
  10. #include <sys/types.h>
  11. #include <time.h>
  12. #include <unistd.h>
  13. typedef struct _ttail_s ttail_t;
  14. #include "config.h"
  15. #include "ttail_search.h"
  16. #define TTAIL_FLAG_PREFIX 1
  17. #define TTAIL_FLAG_DATE_MIN 2
  18. #define TTAIL_FLAG_DATE_MAX 4
  19. #define TTAIL_FLAG_FORMAT 8
  20. #define TTAIL_DEFAULT_FORMATS {"%m",\
  21. "%A %B %d, %Y %H:%M:%S",\
  22. "%A",\
  23. "%B%n%d %H:%M:%S",\
  24. "%B%n%d %H:%M",\
  25. "%m/%d/%y %I %p",\
  26. "%d,%m,%Y %H:%M",\
  27. "at %A the %dst of %B in %Y",\
  28. "run job at %I %p,%B %dnd",\
  29. "%A den %d. %B %Y %H.%M Uhr",\
  30. "%c",\
  31. "%y/%m/%d",\
  32. "%Y/%m/%d",\
  33. "%y-%m-%d",\
  34. "%Y/%m/%d:%H:%M",NULL}
  35. struct _ttail_s
  36. {
  37. char **logfile_name; /*!< logfiles name */
  38. FILE **logfile; /*!< logfiles pointers */
  39. size_t logfile_sz; /*<! logfiles count */
  40. /*! A regex matching the datetime prefix in loglines */
  41. regex_t date_prefix;
  42. /*! A strptime format matching datetime in logfile */
  43. char *fmt;
  44. /*! Date min set from cli */
  45. struct tm date_min;
  46. struct tm date_max;
  47. int verbose;
  48. /**@brief Status flag
  49. *
  50. *see TTAIL_FLAG_*
  51. */
  52. int flag;
  53. ttail_search_t *session;
  54. };
  55. #endif