Graylog2 / Graylog2/graylog2-server
syslog(TCP) format(rfc3164 and rfc5424) error with syslog-ng
- Dominant language
- Java
- Stars
- 8.1k
- Forks
- 1.1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 217
Description
When I use syslog-ng to forward logs from a text file to graylog's syslog inputs, I misused the syslog-ng's destination:
```
destination d_graylog {
tcp("syslog.local.net" port(514) );
};
```
And the graylog server regard it as an rfc3164 format, that's good so far since the messages forwarded successfully. And I can change the hostname by rerwite module:
```
rewrite r_test {
set("hello.localhost", value("HOST"));
};
```
But when I want to add some `tags` such as `PROGRAM` or `PID`, graylog couldn't recognize them:
```
rewrite r_test {
set("hello.localhost", value("HOST"));
set("111", value("PID"));
set("test", value("PROGRAM"));
};
```
Then I searched for it and finally change the destination from `tcp()` to `syslog()`:
```
destination d_graylog {
syslog("syslog.local.net" port(514) );
};
```
But graylog still couldn't parse that message.
Until I stooped the syslog-ng for a while to waiting for the connection closed and then start the syslog-ng again.
It seems that the graylog server will create a session for clients and set the log format of that session. When I reload syslog-ng, the session still exist, so graylog will treat the new messages as the old ones, in this case, the graylog treat the rfc5424 as rfc3164.
## Your Environment
* Graylog Version: `graylog/graylog:2.4.3-1`
* Elasticsearch Version: `docker.elastic.co/elasticsearch/elasticsearch:5.6.3`
* MongoDB Version: `mongo:3`
* Docker Version: `18.02.0-ce`
And the final config is:
```
source s_test {
file("/var/log/test", flags(no-parse), tags("syslog-ng-test") );
};
rewrite r_test {
set("local", value("HOST"));
set("111", value("PID"));
set("test", value("PROGRAM"));
};
destination d_graylog {
# tcp("syslog.localhost.net" port(514) );
syslog("syslog.localhost.net" port(514) );
};
log {
source(s_test);
rewrite(r_test);
destination(d_graylog);
};
```
Contributor guide
Assessment
This issue has not been assessed yet.