• Possible bug? Duplicate syslog entries

    From Karloch@1:103/705 to All on Mon Dec 12 14:09:20 2016
    When I was using Debian with SysV Init, I ran Synchronet as daemon and it logged to syslog perfectly. However, since I moved to Ubuntu and systemd, whatever I run sbbs with nd and syslog parameters together I get duplicated syslog entries. The executed command line is:

    /sbbs/exec/sbbs nd syslog

    And in the syslog I can see things like:

    Dec 12 22:42:35 HISPAMSX sbbs: srvc 0018 closing Gopher socket on port 70
    Dec 12 22:42:35 HISPAMSX sbbs: 12/12 22:42:35 srvc 0018 closing Gopher socket on port 70

    Notice the duplicated entrie has a date that could be the clue for what's happening.

    If I run "/sbbs/exec/sbbs d syslog" I don't get the duplicated entries. However, systemd doesn't play nice with Synchronet daemonized.

    I have discarded wrong syslog configuration ussing "logger".

    $ logger -p local3.info "This is a Facility 3 test"

    The message is logged just once.

    Remember:
    sbbs d syslog -> Logging correctly, just once. Doesn't work with systemd.
    sbbs nd syslog -> Duplicated syslog entries. Works nice with systemd.

    Could it be a bug? Taking a look at the code:

    ==== sbbscon.c
    if (is_daemon || syslog_always) { <- NOT daemon, SYSLOG, enter condition
    if(str==NULL) <- It's not null
    return(0);
    if (std_facilities) <- Not clear to me this condition
    syslog(level|LOG_AUTH,"%s",str); <- Ok, logging once
    else
    syslog(level,"term %s",str); <----- Ok, logging once
    if(is_daemon)
    return(strlen(str)); <- It's not, shouldn't be returning anything
    }

    So it's not clear to me what could be happening... Any ideas?

    Greets,
    Carlos
    --- SBBSecho 3.00-Win32
    * Origin: Vertrauen - vert.synchro.net (1:103/705)
  • From Digital Man@1:103/705 to Karloch on Mon Dec 12 15:54:44 2016
    Re: Possible bug? Duplicate syslog entries
    By: Karloch to All on Mon Dec 12 2016 02:09 pm

    When I was using Debian with SysV Init, I ran Synchronet as daemon and it logged to syslog perfectly. However, since I moved to Ubuntu and systemd, whatever I run sbbs with nd and syslog parameters together I get duplicated syslog entries. The executed command line is:

    /sbbs/exec/sbbs nd syslog

    And in the syslog I can see things like:

    Dec 12 22:42:35 HISPAMSX sbbs: srvc 0018 closing Gopher socket on port 70 Dec 12 22:42:35 HISPAMSX sbbs: 12/12 22:42:35 srvc 0018 closing Gopher socket on port 70

    Notice the duplicated entrie has a date that could be the clue for what's happening.

    If I run "/sbbs/exec/sbbs d syslog" I don't get the duplicated entries. However, systemd doesn't play nice with Synchronet daemonized.

    I have discarded wrong syslog configuration ussing "logger".

    $ logger -p local3.info "This is a Facility 3 test"

    The message is logged just once.

    Remember:
    sbbs d syslog -> Logging correctly, just once. Doesn't work with systemd. sbbs nd syslog -> Duplicated syslog entries. Works nice with systemd.

    Could it be a bug? Taking a look at the code:

    ==== sbbscon.c
    if (is_daemon || syslog_always) { <- NOT daemon, SYSLOG, enter condition
    if(str==NULL) <- It's not null
    return(0);
    if (std_facilities) <- Not clear to me this condition
    syslog(level|LOG_AUTH,"%s",str); <- Ok, logging once
    else
    syslog(level,"term %s",str); <----- Ok, logging once
    if(is_daemon)
    return(strlen(str)); <- It's not, shouldn't be returning anything
    }

    So it's not clear to me what could be happening... Any ideas?

    It sounds like you're running Synchronet as a daemon, but not *telling* sbbs to daemonize. That is not a supported setup. Others are running Synchronet correctly daemonized with systemd just fine, so I think it is possible. So you need to get sbbs working *with* the daemonize option and your dupliate syslog output will stop.

    digital man

    Synchronet/BBS Terminology Definition #49:
    SyncTERM = The Synchronet Terminal Emulator/BBS-client program
    Norco, CA WX: 63.7oF, 67.0% humidity, 2 mph ESE wind, 0.00 inches rain/24hrs --- SBBSecho 3.00-Win32
    * Origin: Vertrauen - vert.synchro.net (1:103/705)
  • From Accession@1:103/705 to Karloch on Mon Dec 12 17:27:26 2016
    Hello Karloch,

    On 12 Dec 16 14:09, Karloch wrote to All:

    Remember:
    sbbs d syslog -> Logging correctly, just once. Doesn't work with
    systemd.

    sbbs nd syslog -> Duplicated syslog entries. Works nice with
    systemd.

    Could it be a bug? Taking a look at the code:

    Are you attempting to log to syslog and journald at the same time? Try just using "sbbs d" and use "journalctl -f".. I don't believe while using systemd you can disable journald, so you are forced to use it. Adding syslog separately

    into the mix seems like it would log to more than one place, which is what seems to be happening in your second case.

    Regards,
    Nick

    ... "-Y-| -+-+-#-A. -> -+-|-|-U-i -e-+-+-i-|-+ -C-#-#-+-e-#-A."
    --- GoldED+/LNX 1.1.5-b20160827
    # Origin: thePharcyde_ distribution system (Wisconsin) (723:1/1)
    * Synchronet * thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin)
    * Origin: Vertrauen - vert.synchro.net (1:103/705)
  • From Karloch@1:103/705 to Digital Man on Thu Dec 15 20:35:34 2016
    Re: Possible bug? Duplicate syslog entries
    By: Digital Man to Karloch on Mon Dec 12 2016 15:54:44

    It sounds like you're running Synchronet as a daemon, but not *telling* sbbs to daemonize. That is not a supported setup. Others are running Synchronet correctly daemonized with systemd just fine, so I think it is possible. So you need to get sbbs working *with* the daemonize option and your dupliate syslog output will stop.

    As it was to be expected, you were right. I managed to run Synchronet in daemonized mode with systemd and the duplicated syslog entries are no more.

    What was actually happening was that I was using Type=simple in the systemd config for SBBS. "simple" is NOT inteded for running process that afterwards execute other process. It looks like when running sbbs daemonized, the main executable launch a new process and then exits gracefully (quite logical) and this was confusing systemd.

    Changing "Type=simple" to "Type=forking" solved the problem. I have made changes in the wiki and I think the systemd Unit file is now finished.

    Thanks for the help!

    Regards,
    Carlos

    ---
    * Synchronet * HISPAMSX BBS - The 8-bit MSX computers BBS - 2:345/111@fidonet
    * Origin: Vertrauen - vert.synchro.net (1:103/705)
  • From Nicholas Boel@1:103/705 to Karloch on Thu Dec 15 22:01:32 2016
    Hello Karloch,

    On Thu, 15 Dec 2016 20:38:10 +0100, Karloch -> Accession wrote:

    There is a lot of people in the forums with problems like the one you are describing. Fortunately, this was not the case, as I just had to run SBBS
    in
    daemonized mode with systemd Unit file as "Type=forking". This solved the issue.

    I'm not sure what forums you're referring to, but I hadn't even thought of that. When I originally made my service file (awhile before you created the page on the wiki), I was already using forking. Sorry I couldn't have been more

    help.

    Regards,
    Nick

    --- slrn/1.0.3 (Linux)
    # Origin: thePharcyde_ distribution system (723:1/1)
    * Synchronet * thePharcyde_ telnet://bbs.pharcyde.org (Wisconsin)
    * Origin: Vertrauen - vert.synchro.net (1:103/705)
  • From Karloch@1:103/705 to Nicholas Boel on Fri Dec 16 11:02:32 2016
    Re: Possible bug? Duplicate syslog entries
    By: Nicholas Boel to Karloch on Thu Dec 15 2016 22:01:32

    I'm not sure what forums you're referring to, but I hadn't even thought of that. When I originally made my service file (awhile before you created the page on the wiki), I was already using forking. Sorry I couldn't have been more help.

    The forums thing is just coincidence, you were really helpful, thank you!

    Regards,
    Carlos

    ---
    * Synchronet * HISPAMSX BBS - The 8-bit MSX computers BBS - 2:345/111@fidonet
    * Origin: Vertrauen - vert.synchro.net (1:103/705)