Hello community, here is the log from the commit of package liblognorm for openSUSE:Factory checked in at 2013-07-21 08:10:38 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/liblognorm (Old) and /work/SRC/openSUSE:Factory/.liblognorm.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "liblognorm" Changes: -------- --- /work/SRC/openSUSE:Factory/liblognorm/liblognorm.changes 2013-04-26 15:52:07.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.liblognorm.new/liblognorm.changes 2013-07-21 08:10:39.000000000 +0200 @@ -1,0 +2,6 @@ +Fri Jul 19 23:20:02 UTC 2013 - [email protected] + +- update to 0.3.7 + - added support to load single samples + +------------------------------------------------------------------- Old: ---- liblognorm-0.3.6.tar.gz New: ---- liblognorm-0.3.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ liblognorm.spec ++++++ --- /var/tmp/diff_new_pack.DWN4Cm/_old 2013-07-21 08:10:40.000000000 +0200 +++ /var/tmp/diff_new_pack.DWN4Cm/_new 2013-07-21 08:10:40.000000000 +0200 @@ -17,7 +17,7 @@ Name: liblognorm -Version: 0.3.6 +Version: 0.3.7 Release: 0 Summary: Library and tool to normalize log data License: LGPL-2.1+ ++++++ liblognorm-0.3.6.tar.gz -> liblognorm-0.3.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblognorm-0.3.6/ChangeLog new/liblognorm-0.3.7/ChangeLog --- old/liblognorm-0.3.6/ChangeLog 2013-03-21 12:05:15.000000000 +0100 +++ new/liblognorm-0.3.7/ChangeLog 2013-07-18 09:37:32.000000000 +0200 @@ -1,4 +1,8 @@ ---------------------------------------------------------------------- +Version 0.3.7, 2013-07-17 +- added support to load single samples + Thanks to John Hopper for the patch +---------------------------------------------------------------------- Version 0.3.6, 2013-03-22 - bugfix: unitialized variable could lead to rulebase load error ---------------------------------------------------------------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblognorm-0.3.6/configure new/liblognorm-0.3.7/configure --- old/liblognorm-0.3.6/configure 2013-03-21 12:05:30.000000000 +0100 +++ new/liblognorm-0.3.7/configure 2013-07-18 09:37:57.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for liblognorm 0.3.6. +# Generated by GNU Autoconf 2.68 for liblognorm 0.3.7. # # Report bugs to <[email protected]>. # @@ -570,8 +570,8 @@ # Identity of this package. PACKAGE_NAME='liblognorm' PACKAGE_TARNAME='liblognorm' -PACKAGE_VERSION='0.3.6' -PACKAGE_STRING='liblognorm 0.3.6' +PACKAGE_VERSION='0.3.7' +PACKAGE_STRING='liblognorm 0.3.7' PACKAGE_BUGREPORT='[email protected]' PACKAGE_URL='' @@ -1309,7 +1309,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures liblognorm 0.3.6 to adapt to many kinds of systems. +\`configure' configures liblognorm 0.3.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1379,7 +1379,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of liblognorm 0.3.6:";; + short | recursive ) echo "Configuration of liblognorm 0.3.7:";; esac cat <<\_ACEOF @@ -1495,7 +1495,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -liblognorm configure 0.3.6 +liblognorm configure 0.3.7 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1918,7 +1918,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by liblognorm $as_me 0.3.6, which was +It was created by liblognorm $as_me 0.3.7, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2733,7 +2733,7 @@ # Define the identity of the package. PACKAGE='liblognorm' - VERSION='0.3.6' + VERSION='0.3.7' cat >>confdefs.h <<_ACEOF @@ -12847,7 +12847,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by liblognorm $as_me 0.3.6, which was +This file was extended by liblognorm $as_me 0.3.7, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12913,7 +12913,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -liblognorm config.status 0.3.6 +liblognorm config.status 0.3.7 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblognorm-0.3.6/configure.ac new/liblognorm-0.3.7/configure.ac --- old/liblognorm-0.3.6/configure.ac 2013-03-21 12:05:24.000000000 +0100 +++ new/liblognorm-0.3.7/configure.ac 2013-07-18 09:37:42.000000000 +0200 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT([liblognorm], [0.3.6], [[email protected]]) +AC_INIT([liblognorm], [0.3.7], [[email protected]]) AM_INIT_AUTOMAKE m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_SRCDIR([src/lognorm.c]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblognorm-0.3.6/src/Makefile.am new/liblognorm-0.3.7/src/Makefile.am --- old/liblognorm-0.3.6/src/Makefile.am 2013-01-16 09:25:36.000000000 +0100 +++ new/liblognorm-0.3.7/src/Makefile.am 2013-07-18 09:37:17.000000000 +0200 @@ -10,6 +10,7 @@ lognormalizer_SOURCES = lognormalizer.c lognormalizer_CPPFLAGS = -I$(top_srcdir) $(LIBEE_CFLAGS) $(LIBESTR_CFLAGS) lognormalizer_LDADD = $(LIBEE_LIBS) $(LIBLOGNORM_LIBS) $(LIBESTR_LIBS) +lognormalizer_DEPENDENCIES = liblognorm.la lib_LTLIBRARIES = liblognorm.la diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblognorm-0.3.6/src/Makefile.in new/liblognorm-0.3.7/src/Makefile.in --- old/liblognorm-0.3.6/src/Makefile.in 2013-03-21 12:05:30.000000000 +0100 +++ new/liblognorm-0.3.7/src/Makefile.in 2013-07-18 09:37:56.000000000 +0200 @@ -97,8 +97,6 @@ PROGRAMS = $(bin_PROGRAMS) am_lognormalizer_OBJECTS = lognormalizer-lognormalizer.$(OBJEXT) lognormalizer_OBJECTS = $(am_lognormalizer_OBJECTS) -lognormalizer_DEPENDENCIES = $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles @@ -261,6 +259,7 @@ lognormalizer_SOURCES = lognormalizer.c lognormalizer_CPPFLAGS = -I$(top_srcdir) $(LIBEE_CFLAGS) $(LIBESTR_CFLAGS) lognormalizer_LDADD = $(LIBEE_LIBS) $(LIBLOGNORM_LIBS) $(LIBESTR_LIBS) +lognormalizer_DEPENDENCIES = liblognorm.la lib_LTLIBRARIES = liblognorm.la liblognorm_la_SOURCES = \ liblognorm.c \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblognorm-0.3.6/src/liblognorm.c new/liblognorm-0.3.7/src/liblognorm.c --- old/liblognorm-0.3.6/src/liblognorm.c 2013-01-16 09:25:36.000000000 +0100 +++ new/liblognorm-0.3.7/src/liblognorm.c 2013-07-18 09:37:17.000000000 +0200 @@ -107,6 +107,17 @@ int +ln_loadSample(ln_ctx ctx, char *buf) +{ + // Something bad happened - no new sample + if (ln_processSamp(ctx, buf, strlen(buf)) == NULL) { + return 1; + } + return 0; +} + + +int ln_loadSamples(ln_ctx ctx, char *file) { int r = 0; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblognorm-0.3.6/src/liblognorm.h new/liblognorm-0.3.7/src/liblognorm.h --- old/liblognorm-0.3.6/src/liblognorm.h 2013-01-16 09:25:36.000000000 +0100 +++ new/liblognorm-0.3.7/src/liblognorm.h 2013-07-18 09:37:17.000000000 +0200 @@ -9,9 +9,9 @@ * For lognorm library files themselves, include "lognorm.h". *//** * @mainpage - * Liblognorm is an easy to use and fast samples-based log normalization + * Liblognorm is an easy to use and fast samples-based log normalization * library. - * + * * It can be passed a stream of arbitrary log messages, one at a time, and for * each message it will output well-defined name-value pairs and a set of * tags describing the message. @@ -73,7 +73,7 @@ /** * The library context descriptor. * This is used to permit multiple independednt instances of the - * library to be called within a single program. This is most + * library to be called within a single program. This is most * useful for plugin-based architectures. */ typedef struct ln_ctx_s* ln_ctx; @@ -167,6 +167,21 @@ void ln_enableDebug(ln_ctx ctx, int i); /** + * Reads a sample stored in buffer buf and creates a new ln_samp object + * out of it. + * + * @note + * It is the caller's responsibility to delete the newly + * created ln_samp object if it is no longer needed. + * + * @param[ctx] ctx current library context + * @param[buf] NULL terminated cstr containing the contents of the sample + * @return Returns zero on success, something else otherwise. + */ +int +ln_loadSample(ln_ctx ctx, char *buf); + +/** * Load a (log) sample file. * * The file must contain log samples in syntactically correct format. Samples are added @@ -188,7 +203,7 @@ * to normalize and will return a normalized in-memory representation * of it. * - * If an error occurs, the function returns -1. In that case, an + * If an error occurs, the function returns -1. In that case, an * in-memory event representation has been generated if event is * non-NULL. In that case, the event contains further error details in * normalized form. @@ -202,7 +217,7 @@ * @param[in] ctx The library context to use. * @param[in] msg The message string (see note above). * @param[in] lenmsg The length of the message in bytes. - * @param[out] event A new event record or NULL if an error occured. <b>Must be + * @param[out] event A new event record or NULL if an error occured. <b>Must be * destructed if no longer needed.</b> * * @return Returns zero on success, something else otherwise. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblognorm-0.3.6/src/samp.c new/liblognorm-0.3.7/src/samp.c --- old/liblognorm-0.3.6/src/samp.c 2013-03-21 12:04:52.000000000 +0100 +++ new/liblognorm-0.3.7/src/samp.c 2013-07-18 09:37:17.000000000 +0200 @@ -75,7 +75,7 @@ if((samp = calloc(1, sizeof(struct ln_samp))) == NULL) goto done; - + /* place specific init code here (none at this time) */ done: return samp; @@ -132,7 +132,7 @@ if(es_strlen(node->name) == 0) { FAIL(LN_INVLDFDESCR); - } + } if(ctx->debug) { cstr = es_str2cstr(node->name, NULL); @@ -281,11 +281,11 @@ /* Implementation note: * We read in the sample, and split it into chunks of literal text and * fields. Each literal text is added as whole to the tree, as is each - * field individually. To do so, we keep track of our current subtree + * field individually. To do so, we keep track of our current subtree * root, which changes whenever a new part of the tree is build. It is * set to the then-lowest part of the tree, where the next step sample * data is to be added. - * + * * This function processes the whole string or returns an error. * * format: literal1%field:type:extra-data%literal2 @@ -373,7 +373,7 @@ } else { es_emptyStr(*str); } - + r = es_addBuf(str, buf + offs, lenBuf - offs); done: return r; } @@ -522,13 +522,13 @@ * @returns 0 on success, something else otherwise */ static inline int -getFieldName(ln_ctx ctx, char *buf, es_size_t lenBuf, es_size_t *offs, es_str_t **strTag) +getFieldName(ln_ctx __attribute__((unused)) ctx, char *buf, es_size_t lenBuf, es_size_t *offs, es_str_t **strTag) { int r = -1; es_size_t i; i = *offs; - while(i < lenBuf && + while(i < lenBuf && (isalnum(buf[i]) || buf[i] == '_' || buf[i] == '.')) { if(*strTag == NULL) { CHKN(*strTag = es_newStr(32)); @@ -562,7 +562,7 @@ /** * Obtain an annotation (field) operation. - * This usually is a plus or minus sign followed by a field name + * This usually is a plus or minus sign followed by a field name * followed (if plus) by an equal sign and the field value. On entry, * offs must be positioned on the first unprocessed field (after ':' for * the initial field!). Extra whitespace is detected and, if present, @@ -670,38 +670,16 @@ done: return r; } - struct ln_samp * -ln_sampRead(ln_ctx ctx, struct ln_sampRepos *repo, int *isEof) +ln_processSamp(ln_ctx ctx, char *buf, es_size_t lenBuf) { struct ln_samp *samp = NULL; - es_size_t offs; - int done = 0; - char buf[10*1024]; /**< max size of rule */ // TODO: make configurable - es_size_t lenBuf; - es_str_t *typeStr = NULL; - - /* we ignore empty lines and lines that begin with "#" */ - while(!done) { - if(feof(repo->fp)) { - *isEof = 1; - goto done; - } + es_str_t *typeStr = NULL; + es_size_t offs; - buf[0] = '\0'; /* fgets does not empty its buffer! */ - fgets(buf, sizeof(buf), repo->fp); - lenBuf = strlen(buf); - if(lenBuf == 0 || buf[0] == '#' || buf[0] == '\n') - continue; - if(buf[lenBuf - 1] == '\n') { - buf[lenBuf - 1] = '\0'; - lenBuf--; - } - done = 1; /* we found a valid line */ - } - ln_dbgprintf(ctx, "read sample line: '%s'", buf); + if(getLineType(buf, lenBuf, &offs, &typeStr) != 0) + goto done; - if(getLineType(buf, lenBuf, &offs, &typeStr) != 0) goto done; if(!es_strconstcmp(typeStr, "prefix")) { if(getPrefix(buf, lenBuf, offs, &ctx->rulePrefix) != 0) goto done; } else if(!es_strconstcmp(typeStr, "extendprefix")) { @@ -719,10 +697,45 @@ goto done; } - - //ln_displayPTree(ctx, ctx->ptree, 0); done: if(typeStr != NULL) es_deleteStr(typeStr); + + return samp; +} + + +struct ln_samp * +ln_sampRead(ln_ctx ctx, struct ln_sampRepos *repo, int *isEof) +{ + struct ln_samp *samp = NULL; + int done = 0; + char buf[10*1024]; /**< max size of rule */ // TODO: make configurable + es_size_t lenBuf; + + /* we ignore empty lines and lines that begin with "#" */ + while(!done) { + if(feof(repo->fp)) { + *isEof = 1; + goto done; + } + + buf[0] = '\0'; /* fgets does not empty its buffer! */ + if (fgets(buf, sizeof(buf), repo->fp) != NULL) { + lenBuf = strlen(buf); + if(lenBuf == 0 || buf[0] == '#' || buf[0] == '\n') + continue; + if(buf[lenBuf - 1] == '\n') { + buf[lenBuf - 1] = '\0'; + lenBuf--; + } + done = 1; /* we found a valid line */ + } + } + + ln_dbgprintf(ctx, "read sample line: '%s'", buf); + ln_processSamp(ctx, buf, lenBuf); + +done: return samp; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/liblognorm-0.3.6/src/samp.h new/liblognorm-0.3.7/src/samp.h --- old/liblognorm-0.3.6/src/samp.h 2013-01-16 09:25:36.000000000 +0100 +++ new/liblognorm-0.3.7/src/samp.h 2013-07-18 09:37:17.000000000 +0200 @@ -73,10 +73,27 @@ /** + * Reads a sample stored in buffer buf and creates a new ln_samp object + * out of it. + * + * @note + * It is the caller's responsibility to delete the newly + * created ln_samp object if it is no longer needed. + * + * @param[ctx] ctx current library context + * @param[buf] cstr buffer containing the string contents of the sample + * @param[lenBuf] length of the sample contained within buf + * @return Newly create object or NULL if an error occured. + */ +struct ln_samp * +ln_processSamp(ln_ctx ctx, char *buf, es_size_t lenBuf); + + +/** * Read a sample from repository (sequentially). * * Reads a sample starting with the current file position and - * creates a new ln_samp object out of it. + * creates a new ln_samp object out of it. * * @note * It is the caller's responsibility to delete the newly -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
