Deployment Architecture

Getting syntax error from interfaces.sh for *nix app

cyndiback
Path Finder

Ubuntu 10.10 / Splunk 4.2.1 / App: *nix 4.2

Yesterday we upgraded to the newest version of Splunk (4.2.1) and upgraded *nix app (4.2). Splunkd is now reporting the following errors:

  • message from "/opt/splunk/etc/apps/unix/bin/interfaces.sh" awk: line 1: syntax error at or near }
  • message from "/opt/splunk/etc/apps/unix/bin/interfaces.sh" awk: line 1: syntax error at or near else
  • message from "/opt/splunk/etc/apps/unix/bin/interfaces.sh" awk: line 1: syntax error at or near ,

I'm unable to identify what the syntax problem is. I've compared the interfaces.sh file on our server to what is posted on the web and they are the same. Is anyone else experiencing this problem?

Tags (3)
1 Solution

hazekamp
Builder

cyndiback, I don't have a specific fix at this time, but this is a known issue logged as (SOLN-1032). Please submit your own case to support@splunk.com for tracking.

Moderator edit:

UPDATE: this issue later became SPL-41361, and should be fixed in the next maintenance release of the app. In the meantime, the glorious Vainstein has provided a patch for ifconfig.sh (sorry about the lines wrapping):

# diff interfaces.sh interfaces-mod.sh 
41,42c41,42
<       SPEED=`dmesg | awk '/[Ll]ink( is | )[Uu]p/ && /'$iface'/ {for (i=1; i<=NF; ++i) {if (match($i, /([0-9]+)([Mm]bps)/, array)) {print array[1] "Mb/s"} else { if (match($i,/[Mm]bps/)) {print $(i-1) "Mb/s"} } } }' | sed '$!d'`
<       DUPLEX=`dmesg | awk '/[Ll]ink( is | )[Uu]p/ && /'$iface'/ {for (i=1; i<=NF; ++i) {if (match($i, /([\-\_a-zA-Z0-9]+)([Dd]uplex)/, array)) {print array[1]} else { if (match($i, /[Dd]uplex/)) {print $(i-1)} } } }' | sed 's/[-_]//g; $!d'`
---
>       SPEED=`dmesg  | awk '/[Ll]ink( is | )[Uu]p/ && /'$iface'/ {for (i=1; i<=NF; ++i) {if (match($i, "([0-9]+)([Mm]bps)"))             {print $i} else { if (match($i, "[Mm]bps"))   {print $(i-1) "Mb/s"} } } }' | sed '$!d'`
>       DUPLEX=`dmesg | awk '/[Ll]ink( is | )[Uu]p/ && /'$iface'/ {for (i=1; i<=NF; ++i) {if (match($i, "([\-\_a-zA-Z0-9]+)([Dd]uplex)")) {print $i} else { if (match($i, "[Dd]uplex")) {print $(i-1)       } } } }' | sed 's/[-_]//g; $!d'`

View solution in original post

dchayla
Engager

On debian :
- install gawk
- modify interfaces.sh :
-replace awk by gawk
- modify the line : CMD='ifconfig'. by removing the dot at the end of this line

it works for me after that

menkurau
Path Finder

we are still having this issue even after upgrading the *nix app to the latest version. anyone?

0 Karma

cafpereira
New Member

I'm also experiencing this same issue my Ubuntu server

0 Karma

dseagrav
Engager

This is caused by mawk. Debian installs mawk instead of gawk by default. Install gawk instead and the error will go away.

cyndiback
Path Finder

Tried resetting to gawk and rebooted machine...This did not fix the error.

0 Karma

poconnell
New Member

+1 having this issue on a new install, further information would be greatly appreciated...

0 Karma

vadud3
Path Finder

I am seeing the same error as well

0 Karma

hazekamp
Builder

cyndiback, I don't have a specific fix at this time, but this is a known issue logged as (SOLN-1032). Please submit your own case to support@splunk.com for tracking.

Moderator edit:

UPDATE: this issue later became SPL-41361, and should be fixed in the next maintenance release of the app. In the meantime, the glorious Vainstein has provided a patch for ifconfig.sh (sorry about the lines wrapping):

# diff interfaces.sh interfaces-mod.sh 
41,42c41,42
<       SPEED=`dmesg | awk '/[Ll]ink( is | )[Uu]p/ && /'$iface'/ {for (i=1; i<=NF; ++i) {if (match($i, /([0-9]+)([Mm]bps)/, array)) {print array[1] "Mb/s"} else { if (match($i,/[Mm]bps/)) {print $(i-1) "Mb/s"} } } }' | sed '$!d'`
<       DUPLEX=`dmesg | awk '/[Ll]ink( is | )[Uu]p/ && /'$iface'/ {for (i=1; i<=NF; ++i) {if (match($i, /([\-\_a-zA-Z0-9]+)([Dd]uplex)/, array)) {print array[1]} else { if (match($i, /[Dd]uplex/)) {print $(i-1)} } } }' | sed 's/[-_]//g; $!d'`
---
>       SPEED=`dmesg  | awk '/[Ll]ink( is | )[Uu]p/ && /'$iface'/ {for (i=1; i<=NF; ++i) {if (match($i, "([0-9]+)([Mm]bps)"))             {print $i} else { if (match($i, "[Mm]bps"))   {print $(i-1) "Mb/s"} } } }' | sed '$!d'`
>       DUPLEX=`dmesg | awk '/[Ll]ink( is | )[Uu]p/ && /'$iface'/ {for (i=1; i<=NF; ++i) {if (match($i, "([\-\_a-zA-Z0-9]+)([Dd]uplex)")) {print $i} else { if (match($i, "[Dd]uplex")) {print $(i-1)       } } } }' | sed 's/[-_]//g; $!d'`

mikelanghorst
Motivator

This is working fine on my linux host, and on Solaris for me. 4.2.1 as well.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Agent Mode Engaged! Enchaining Agentic Operations with Splunk AI Assistant 2.0

    Are you ready to transform how your team handles complex data requests? We invite you to our upcoming ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...