Visit The New, Modern Unix Linux Community

Operating Systems OS X (Apple) How can I direct messages from mac to a log file? Post 303038513 by Neo on Thursday 5th of September 2019 01:56:10 AM

It looks like the level of detail you are looking for is not available in system_profiler and you may have no choice but to use the logfiles (syslog) as you were doing (indirectly via automatically shows system.log, and other log files, so you don't need to redirect entries from but you need to find the (syslog) file which used.

Make sense?



You can monitor it easily using tail -f /var/log/system.log

Reference: see also the "logger" (man logger) and "syslog" (man syslog).

Please post back with the details of which log file you found had the information you need.

Test Your Knowledge in Computers #72
Difficulty: Easy
The 'Unix philosophy' is a computer design philosophy based on creating small, modular utilities that do one thing and do them well.
True or False?

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Re-direct the error msg to log file

Hi All, I have an expression as follows:- a=`expr ${i} + ${j}` >> $log_file 2>&1 Here, if any of the values i or j or both happens to be empty then the "expr" returns error as "expr: 0402-050 Syntax error." My problem is I am not able to re-direct this error to the log file. Its is getting... (4 Replies)
Discussion started by: rony_daniel
4 Replies

2. Shell Programming and Scripting

Direct the output of a script to a log file

Hi, I have a script to compare 2 files. file1=$1 file2=$2 num_of_records_file1=`awk ' END { print NR } ' $file1` num_of_records_file2=`awk ' END { print NR } ' $file2` i=1 while do sed -n "$i"p $file1 > file1_temp sed -n "$i"p $file2 > file2_temp diff file1_temp... (5 Replies)
Discussion started by: autosys_nm
5 Replies

3. Shell Programming and Scripting

Set default app for file type on Mac

Hi there, We have 2 apps on our customers machines that can both open files with the same file extension. Is there any way via shell commands to set which application should be the default? Essentially, I'm hoping to replicate Get Info > Open With > Change All using a shell script, but I just... (0 Replies)
Discussion started by: davewg
0 Replies

4. Shell Programming and Scripting

Need Mac .sh to run command line app in seperate terminal

Hello, currently we are executing a .sh from terminal. The current .sh looks like this: #!/usr/bin/env bash /Users/user/ & -- Now, we also need to run a third line in the .sh - It's a command line application that I need to run when I execute the above .sh... (0 Replies)
Discussion started by: yoyoyo777
0 Replies

5. UNIX for Dummies Questions & Answers

re-direct to log file

#!/bin/ksh -x cd /tmp/tj ftp -n << DONE user username password as put test.log quit close DONE echo "testing..." sh -x scriptname, and it shows all, but username, as, put, quit, close, DONE. how can i see those ? (1 Reply)
Discussion started by: tjmannonline
1 Replies

6. Shell Programming and Scripting

Manipulating sed Direct Input to Direct Output

Hi guys, been scratching round the forums and my mountain of resources. Maybe I havn't read deep enough My question is not how sed edits a stream and outputs it to a file, rather something like this below: I have a .txt with some text in it :rolleyes: abc:123:xyz 123:abc:987... (7 Replies)
Discussion started by: the0nion
7 Replies

7. Cybersecurity

Best practice to allow 3rd party app to read messages file.

What is the best practice to allow a 3rd party health monitoring app to read the messages file. Since messages is a system file and is owned by root the app cannot read the file. I don't want to run the app as root so how should I allow the app to read the file. The read function is actually built... (2 Replies)
Discussion started by: slwiley
2 Replies
SYSLOG(3)								 1								 SYSLOG(3)

syslog - Generate a system log message

bool syslog (int $priority, string $message) DESCRIPTION
syslog(3) generates a log message that will be distributed by the system logger. For information on setting up a user defined log handler, see the syslog.conf(5) Unix manual page. More information on the syslog facili- ties and option can be found in the man pages for syslog(3) on Unix machines. PARAMETERS
o $priority -$priority is a combination of the facility and the level. Possible values are: syslog(3) Priorities (in descending order) +------------+------------------------------------+ | Constant | | | | | | | Description | | | | +------------+------------------------------------+ | | | | LOG_EMERG | | | | | | | system is unusable | | | | | | | | LOG_ALERT | | | | | | | action must be taken immediately | | | | | | | | LOG_CRIT | | | | | | | critical conditions | | | | | | | | LOG_ERR | | | | | | | error conditions | | | | | | | |LOG_WARNING | | | | | | | warning conditions | | | | | | | |LOG_NOTICE | | | | | | | normal, but significant, condition | | | | | | | | LOG_INFO | | | | | | | informational message | | | | | | | | LOG_DEBUG | | | | | | | debug-level message | | | | +------------+------------------------------------+ o $message - The message to send, except that the two characters %m will be replaced by the error message string (strerror) corresponding to the present value of errno. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 Using syslog(3) <?php // open syslog, include the process ID and also send // the log to standard error, and use a user defined // logging mechanism openlog("myScriptLog", LOG_PID | LOG_PERROR, LOG_LOCAL0); // some code if (authorized_client()) { // do something } else { // unauthorized client! // log the attempt $access = date("Y/m/d H:i:s"); syslog(LOG_WARNING, "Unauthorized client: $access {$_SERVER['REMOTE_ADDR']} ({$_SERVER['HTTP_USER_AGENT']})"); } closelog(); ?> NOTES
On Windows NT, the syslog service is emulated using the Event Log. Note Use of LOG_LOCAL0 through LOG_LOCAL7 for the $facility parameter of openlog(3) is not available in Windows. SEE ALSO
openlog(3), closelog(3). PHP Documentation Group SYSLOG(3)

Featured Tech Videos

All times are GMT -4. The time now is 10:09 PM.
Unix & Linux Forums Content Copyright 1993-2020. All Rights Reserved.
Privacy Policy