Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This feature is only available with frameworks ['arduino']. #18

Open
dig12345 opened this issue Sep 13, 2024 · 7 comments
Open

This feature is only available with frameworks ['arduino']. #18

dig12345 opened this issue Sep 13, 2024 · 7 comments

Comments

@dig12345
Copy link

Any chance we can get this to work with:
framework:
type: esp-idf

I need that for a different component (secplus_gdo) I believe.

@TheStaticTurtle
Copy link
Owner

Hi,

This has been reported multiple times!
You can try PR #17 by @dwmw2, I haven't had an opportunity to test/validate it yet, but it seems to work for him and possibly others.

Sorry for being so absent for this issue, I'll keep this open until something gets merged to fix it.

Thanks

@dwmw2
Copy link

dwmw2 commented Sep 13, 2024

Welcome back :)

Now it works fairly much everywhere (even using it on LibreTiny BK72xx devices now) I'm tempted to tidy it up a little and submit it for inclusion in ESPHome. Would you be OK with that? Want to be listed as a CODEOWNER?

@TheStaticTurtle
Copy link
Owner

Thanks,

I worked on this a bit a long while ago, I wanted to write a proper syslog client library which would be portable across projects, but it got abandoned due to lack of time.

I just re-read the code, and it seems fine, the IETF format looks correct.
I'll try to do some tests tonight/weekend, I don't have direct access to my setup right now.

Cool that it works with LibreTiny but it makes sense now that there is no mention of esp/Arduino in the code.

As for submitting for inclusion in ESPHome, it has already been suggested as a feature request, but that was a while ago. If cleaned-up and up to standards, they might want it (I'll be OK with it, same with being a codeowner)

IMO, here are a few things that need to be done before :

  • Better way of stripping the ANSI control sequences
  • Checking that it stills works when Wi-Fi/Ethernet disconnects / reconnects
  • Update the code to follow ESPHome's codebase standards

Anyway, thanks for the PR, I'll try to build a dev environment in the following days
Don't hesitate to ping me if I forget, this has been open for far too long.

@dwmw2
Copy link

dwmw2 commented Sep 13, 2024

Yeah, I have been thinking of fixing the escape code stuff; some of them do still escape.

It does work when WiFi reconnects, but perhaps only if the IP address doesn't change. I'll see if I can test that.

I also had DNS support on my TODO list before submitting it.

@dig12345
Copy link
Author

Thank you for this! I was finally able to capture logs. I used the following config:

external_components:
  - source:
      url: https://github.com/dwmw2/esphome_syslog.git
      type: git
      ref: esp-ipv6-support
    components: [syslog]

syslog:
    ip_address: "192.168.4.254"
    port: 514
    strip_colors: true

Some interesting things:

  1. I am still seeing some color tags eg:
    Sep 15 17:05:54 grgdo1 esp-idf [D][esp-idf:000]#033[1;31m[gdo_main_task]#033[0;36m: #033[0;32mI (8286) gdolib: cmd=308 (PAIRED_DEVICES) byte2=03 byte1=00 nibble=1#033[0m S (I see you noted that above)
  2. Interesting that it refuses to send to a syslog server on another subnet, this may be an esphome security limitation, dunno... I ended up creating a port forward on the local vlan router over to the correct server but that was took a while to realize why it wasn't sending any syslog packets.
  3. What log level does it filter on? I have
logger:
 level: VERY_VERBOSE

but that seems to only apply to the logs presented inside ESPhome not the syslog ones.

Anyway much appreciate the work on this, I've been wanting log capture for a long time and this works!

@dwmw2
Copy link

dwmw2 commented Sep 16, 2024

  1. Yes, we talked about better filtering of escape codes but I haven't done anything about it yet.
  2. That's odd; I don't have that problem. My syslog server is on a different subnet (both IPv6 and Legacy IP), and both work. Are you sure it isn't falling foul of firewall rules?
  3. I haven't changed anything about log levels. Not intentionally at least.

I suspect this version may break on rp2040 and esp8266 — we actually do need to use the Arduino UDP there. See discussion in esphome/esphome#4969

@mateuszdrab
Copy link

  1. Yes, we talked about better filtering of escape codes but I haven't done anything about it yet.
  2. That's odd; I don't have that problem. My syslog server is on a different subnet (both IPv6 and Legacy IP), and both work. Are you sure it isn't falling foul of firewall rules?
  3. I haven't changed anything about log levels. Not intentionally at least.

I suspect this version may break on rp2040 and esp8266 — we actually do need to use the Arduino UDP there. See discussion in esphome/esphome#4969

Thanks for the PR. Works fine here on esp_idf across subnets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants