Sorry for my late reply. (disease, and missing lots of mail from thousands spam) I read you reply carefully. basically, the reason is, e.g. squid, though some like improper. because squid have own log builtin support when compile. 1. I want to use the last version squid in my VPS. so, i have to compile it myself. 2. I need a common startup script for squid to start. simply enough, I add one line in my crontab '@reboot /usr/local/bin/start_squid' `start_squid' is a bash script for start squid correctly. 3. i want to record log to file, for some net analysis. I am not a linux administrator, less experience for logger, i hope spend minimum cost to achieve a sysetm logger like service. function included following: - rotately automatically. - can be output real time if need. I often read log when in programming development, so i think log is useful in this case. The problem is: 1. What is the correct way to add my startup script log into journalctl or something else? (suppose not use opensuse squid package startup script or systemd service. because I want this script to be use in any linux distribution, e.g: debian) 2. if use `ssh -vvv 2>~/ssh.log' way, should i must to add rotately function myself ? is there exist convenient way for this? Thanks very much. Anton Aylward writes:
On 03/03/2016 03:47 AM, Carlos E. R. wrote:
On 2016-03-03 04:27, Billy.Zheng (zw963) wrote:
No, sorry, I have very poor knowledge about how system log is worked. What i need is just a simple way to add application log to one file.
My VPS use openSUSE 42.1, I deploy some application in it, with some self-defined boot start bash scripts, I want a simple way to write all application log to same file.
If you want to write to a single file, just write yourself to it.
echo "some text" >> somefile
Yes, but don't make "somefile" /var/log/messages. Doing so will probably corrupt the proper message stream.
start_some_application |logger
Not the way to use it, IMHO.
Agreed.
For example, "ssh -vvv" produced more information. But that's about a single user trying to connect, it is NOT a system activity, thus
ssh -vvv 2>~/ssh.log
makes more sense in this context than using syslog.
I hope it logger output to one file which I familiar and commonly. the only I know from slackware is /var/log/messages.
This is not slackware. This is not the 20th century.
so, I don't know if some *service* is depend on /var/log/message.
No, nothing should depend on /var/log/message
I'd emphasise the 'should". There are probably many archaic programs that have not been dragged kicking and screaming into The Century of the Fruitbat, sorry, the 21st century, and still work by doing what amounts to "tail -f /var/log/messages" as did that old steadfast "swatch". http://linux.die.net/man/1/swatch But then swatch could be pointed at any file, including ~/ssh.log or included in a pipeline.
So "journalctl -f | swatch" would work.
I should note that the tool has been renamed to 'swatchdog' so as not to offend a Swiss watch company. it does not seem to have been updated to deal with journald directly.
That being said, the kind of people who would have used 'swatch' in days of old probably now use the "Simple event correlator", https://sourceforge.net/projects/simple-evcorr http://simple-evcorr.github.io/ or similar.
As it stands, journalctl is quite flexible. https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-vi... and http://0pointer.de/blog/projects/journalctl.html
Which gets back to the question
Why are you logging?
-- A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting frowned upon?
-- Geek, Rubyist, Emacser 程序员中的牛逼运维, 运维中的牛逼程序员。 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org