This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shell判断文件,目录是否存在或者具有权限 | |
| #!/bin/sh | |
| Path="/var/log/httpd/" | |
| File="/var/log/httpd/access.log" | |
| #这里的-x 参数判断$Path是否存在并且是否具有可执行权限 | |
| if [ ! -x "$Path"]; then | |
| mkdir "$Path" | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val df = spark.read.text(inputFile) | |
| df.createOrReplaceTempView("data") | |
| val query = | |
| """ | |
| | WITH loglevel AS (SELECT SPLIT(value, ' ')[0] AS level FROM data WHERE LENGTH(value) > 0), | |
| | levelcount AS (SELECT level, COUNT(*) as count FROM loglevel GROUP BY level) | |
| | SELECT level, count FROM levelcount ORDER BY count DESC | |
| """.stripMargin |
OlderNewer