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

Wrong process name/pid #4

Closed
seppo0010 opened this issue Aug 5, 2015 · 12 comments
Closed

Wrong process name/pid #4

seppo0010 opened this issue Aug 5, 2015 · 12 comments

Comments

@seppo0010
Copy link

In OS X the logs look like this

Aug  4 16:57:15 Seppos-MacBook-Air Unknown[4294967295] <Alert>: "hello world"

Notice Unknown[4294967295], which are supposed to be the process name and id, both are incorrect.

In Linux, they look like this

Aug  4 23:59:14 vagrant-ubuntu-trusty-64 ntpdate[1436]: adjust time server 91.189.89.199 offset -0.007467 sec
Aug  4 23:59:51 vagrant-ubuntu-trusty-64  "hello world"

Included ntpdate as a reference. Process name and pid are skipped.

@seppo0010
Copy link
Author

In my use case specifically, I'd like to be able to customize the identifier and not take automatically the process name. See https://github.com/antirez/redis/blob/unstable/redis.conf#L145 as a reference.

@Geal
Copy link
Owner

Geal commented Aug 5, 2015

Could you show me the ode you are using? send does not add any information, it just sends your message to syslog, in case you want to format it yourself. send_3164 and send_5424should do what you want.

Right now, for me, on OSX I get (with examples/write.rs, just after fixing #3):

Aug  5 09:25:56 MacBook-de-Geo Unknown: hello world

If I change the function to send_3164, I get:

Aug  5 09:26:35 MacBook-de-Geo 2015-08-05T07: 26:35Z localhost write[56190]: hello world

@Geal
Copy link
Owner

Geal commented Aug 5, 2015

I'll add a function to modify the process name

@Geal
Copy link
Owner

Geal commented Aug 5, 2015

Ok, 1c768ad should have the functions you need.

@seppo0010
Copy link
Author

In both cases, I'm using the code from README.md:

extern crate syslog;

use syslog::{Facility,Severity};

fn main() {
  match syslog::unix(Facility::LOG_USER) {
    Err(e)         => println!("impossible to connect to syslog: {:?}", e),
    Ok(writer) => {
      let r = writer.send(Severity::LOG_ALERT, String::from("hello world"));
      if r.is_err() {
        println!("error sending the log {}", r.err().expect("got error"));
      }
    }
  }
}

@seppo0010
Copy link
Author

Do you want me to run it with some extra debug code?

@Geal
Copy link
Owner

Geal commented Aug 5, 2015

Can you try with the version 2.2.0? I'll update the readme to put send_3164 instead of send.

@seppo0010
Copy link
Author

It works fine if I use send_3164. I'm not sure what send is doing reading its source, so I think this is not an issue... updating README will be useful. Thanks!

@Geal
Copy link
Owner

Geal commented Aug 24, 2015

README fixed in 2dd4245

@seppo0010
Copy link
Author

In c287654 perhaps? 😀

@Geal
Copy link
Owner

Geal commented Aug 24, 2015

Yes, obviously. Sorry, I am really tired right now, and should not mess around much with code :)

Did the set_process function work for you?

@seppo0010
Copy link
Author

Yes, set_process_name worked. Thanks.

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

2 participants