Logging Network activity

Discussion in 'C-Bus Wired Hardware' started by znelbok, Jan 8, 2018.

  1. znelbok

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,151
    Likes Received:
    17
    I there a way to log what happening on the network?

    I know there is the Application log in toolkit, but it does not appear to be able to log to a file.

    i want the same thing but logging to a file as I need to try and track down some small issues on a network. There is also a CTC and a W2 on the network - not sure if they can do this at all - I don't think the W2 can.

    Toolkit can be left open, but it can be closed accidentally and when that happens all the logged information is lost. It would be great if here was an option for log to file instead of just save to file.

    Does C-Gate keep an application log - this is running as a service and I know there are event log files, but they are not appearing to have the application information logged in a manner that is easy to parse. Can it (C-Gate) do an application log to file?
     
    znelbok, Jan 8, 2018
    #1
  2. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hi Mick
    If you have CGate running and connected it will save events as a text file.
    Even a raspberry pi might be a handy tool to leave on a site for this.
    To get less information you can change the event levels.
    This would be done in the CGate config settings.
    To see what the output looks like try this.

    open a telnet session to CGate port 20023
    enter this
    events e1s1c0
     

    Attached Files:

    DarylMc, Jan 8, 2018
    #2
  3. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    I just tried to set CGate event log on the raspberry pi to give just the application log activity.
    Not having a lot of success yet.
     
    DarylMc, Jan 8, 2018
    #3
  4. znelbok

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,521
    Likes Received:
    173
    Location:
    Adelaide, Australia
    The Cbus diagnostic utility can log commands to a file.
     
    Ashley, Jan 8, 2018
    #4
  5. znelbok

    NickD Moderator

    Joined:
    Nov 1, 2004
    Messages:
    1,420
    Likes Received:
    62
    Location:
    Adelaide
    The diagnostic utility is a much better option in most cases IMO.

    C-Gate logs are useful if you're trying to debug problems with C-Gate clients connected to a network (eg Toolkit or Schedule Plus etc), as they have detail about what C-Gate thinks is going on, but I don't find them particularly easy to trawl through.

    Nick
     
    NickD, Jan 9, 2018
    #5
  6. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    @NickD
    @Ashley
    Not that I know much about how to do it.
    I had the idea Mick is trying to parse the relevant data to another application.
    I'm counting on you both to help me learn something today.
    I use programming which does that but I do not understand much about it.
     
    DarylMc, Jan 9, 2018
    #6
  7. znelbok

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,521
    Likes Received:
    173
    Location:
    Adelaide, Australia
    To log from C-Gate connect to the status change port 20025. I use Terra Term, a free Telnet client that can log all output to a file.
     
    Ashley, Jan 9, 2018
    #7
  8. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Thanks Ashley
    That is certainly something new to look at.
    I've had some problems on a job right now.
    Maybe I got it all wrong.
    I'm very suspicious of the latest cgate.

    When I get there I will have a look. at the CGate logs first thing.
    The DALI lights on site appear to have some problems
     
    DarylMc, Jan 9, 2018
    #8
  9. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
     
    DarylMc, Jan 9, 2018
    #9
  10. znelbok

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,151
    Likes Received:
    17
    Sounds like we can do a event logger with a Pi then.

    C-Gate on PI,terminal program that can log to a SD card and that should be about it. Samba for Windows file access. Option to connect to a remote c-gate as PCI can only handle on connection.

    As a bonus a web interface that parses the log file and shows a layout similar to toolkit
     
    znelbok, Jan 13, 2018
    #10
  11. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Hi Mick
    Do you just want to keep a simple application log like the toolkit one?
    Because the CGate logs have too much information and no tags?
     
    DarylMc, Jan 13, 2018
    #11
  12. znelbok

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,521
    Likes Received:
    173
    Location:
    Adelaide, Australia
    [QUOTE="Because the CGate logs have too much information and no tags?[/QUOTE]

    You can get tags by setting the config option 'tag-name-output' to true, although for some reason you then only get the group name, not the network or application. But as you say, it's not easy to read or process.
     
    Ashley, Jan 13, 2018
    #12
    DarylMc likes this.
  13. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    Thanks Ashley I didn’t know that.
     
    DarylMc, Jan 13, 2018
    #13
  14. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    @Ashley
    I just tried tag-name-output=yes on my Homebridge pi3.
    Just wanted to mention it stopped Homebridge CBus from working.
    Maybe it's time for me to stop playing with CGate config :)
    Set it back to no, all good.

    I don't actually have any need to play around with the logging.
    It's all there on the pi's CGate.
    Was just looking at Mick's case out of interest.
    I suppose I did learn something.
     
    DarylMc, Jan 14, 2018
    #14
  15. znelbok

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,521
    Likes Received:
    173
    Location:
    Adelaide, Australia
    [QUOTE="Just wanted to mention it stopped Homebridge CBus from working.[/QUOTE]

    That's to be expected as homebridge will be looking for numbers, not names. I think that is why tag names in cgate were discouraged as names can change but numbers don't. The option is really only useful for logging with a dedicated cgate
     
    Ashley, Jan 14, 2018
    #15
    DarylMc likes this.
  16. znelbok

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,151
    Likes Received:
    17
    That's working pretty good I get the following now when I turn a light on

    lighting off Kitchen Work #sourceunit=230 OID=a2c6ae30-d750-1035-8c3f-c7cd5504769a

    Any way to get a time stamp with it?

    What bout the source unit - can we somehow get a name against it as well?

    Anyone know of a good way to run a telnet session to C-Gate and log to file in raspbian?
     
    znelbok, Jan 14, 2018
    #16
  17. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    which method are you using.
    events?
    Higher event levels will give a time stamp and source unit.
    I think CGate log might be easiest.
    Depending on what you want to do you can filter them with a text editor or spreadsheet.
     
    DarylMc, Jan 14, 2018
    #17
  18. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    DarylMc, Jan 14, 2018
    #18
  19. znelbok

    znelbok

    Joined:
    Aug 3, 2004
    Messages:
    1,151
    Likes Received:
    17
    Yeah I have samba running so I can access the log files via SMB.

    I'm not getting anything being written to the log directory now (since I chanced something the other day)

    Not sure what it was an how to get it back to writing logs either.

    I tried different event levels but there does not appear to be any change to the output.

    Restarting C-Gate also resets the events back to e0s0c0.
     
    znelbok, Jan 14, 2018
    #19
  20. znelbok

    DarylMc

    Joined:
    Mar 24, 2006
    Messages:
    1,308
    Likes Received:
    49
    Location:
    Cleveland, QLD, Australia
    I just went through all my cgate config settings and manually set it back to default today.
    Maybe I should have made a copy before I started making a lot of changes.
    There is heaps of options for the events in cgate config but unfortunately I can't help you much with using them.

    Have you looked in /usr/local/bin/cgate/logs
     
    DarylMc, Jan 14, 2018
    #20
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.